Description

In this article I am going to walk through the process of building custom forms using SharePoint Designer 2013. We are going to create three separate forms for a custom list. First a custom new item form, second a display item form and finally an edit item form.

Setting the Scene

I have created a custom list call Request Form which a student will fill to submit an event request. The counselor will use the edit item form and either approve or deny the request. 

Building the List

Below is a screenshot of the columns created in the custom list.




The columns I have shown above are self-explanatory, however, I am going to provide the choices I have added to the Choice column. The default value of  the below choice columns are blank.

Approved By Counselor



Event Type



State



Current Status


Building the Form

This section describes the process of building custom new, display and edit forms using SharePoint Designer 2013. 

New Item Form

Below is a screenshot of what SharePoint Designer 2013 looks like when I have opened the site. Request Form is the list I am focusing on.



Below are the settings of the list. We are going to use the Forms section to build the custom forms.



Click on the Form's New button and fill the information as shown below. Select the 'Set as default form for the selected type' . Click OK.



Now in Forms you should see  your new custom form. Click on the form. You should now be presented with the CustomNewForm code. Below is a screenshot.



Click on 'CustomNewForm.aspx' to view the code. The first 23 lines are highlighted yellow which you cannot edit and hence when you click on it, the Data View Tools will not be available. I have provided screenshots of what the ribbon looks like with and without the tools.
Below is as screenshot without Data View tools. This is because the cursor is on the highlighted yellow code.



Below is a screenshot with Data View Tools



The below table contains the columns that the new form should contain, the rest can be deleted.



In the code right-click and choose 'Find…' from the drop-down list.  Type in 'Counselor comment'. Below are screenshots





We need to delete both the ms-formlabel and the ms-formbody for this column. Below is the code that NEEDS TO BE DELETED. I have also provided a screenshot as well.

<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Counselor Comment</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="ff6{$Pos}" ControlMode="New" FieldName="Counselor_x0020_Comment" __designer:bind="{ddwrt:DataBind('i',concat('ff6',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Counselor_x0020_Comment')}"/>
<SharePoint:FieldDescription runat="server" id="ff6description{$Pos}" FieldName="Counselor_x0020_Comment" ControlMode="New"/>
</td>
</tr>




Do the same for the other columns that need to be deleted for this view. 
Once you have deleted the columns, click Save and then Preview in Browser. Saving the changes you made in the form can take a few seconds. 



Below is a screenshot of the CustomNewForm.aspx



Remove the Save and Cancel button

I am now going to remove the Save and Cancel button from the top and give this form a title. In SharePoint Designer 2013, in the code right-click and choose 'Find…' from the drop-down list.  Type in 'savebutton1'. Below is what you are looking for.  Delete that code. I have also provided a copy of that code below.

<tr>
<td class="ms-toolbar" nowrap="nowrap">
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap="nowrap"><IMG SRC="/_layouts/15/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="nowrap">
<SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton1"/>
</td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="nowrap" align="right">
<SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton1"/>
</td>
</tr>
</table>
</td>
</tr>




Again, click Save and then Preview in Browser. Now, as shown below, you should not see the Save and Cancel button on the top.



Add Title

In the CustomNewForm.aspx search for dvt_1.body. Below is what you should find.



Right below <xls:template name="dvt_1.body"> , type in a form name, for example 'New Request form'. Below is a screenshot



Again, click Save and then Preview in Browser. Below is what you will see. 



To make the text look like a prominent title, go back to SharePoint Designer, highlight the 'New Request Form', click on the Home ribbon and select the font type and size.
I selected my font type to be 'Times New Roman' and font size as x-Large which will automatically change the code. Below is what you will see



Again, click Save and then Preview in Browser. Below is what you will see. 



Below is a video which walks you through the steps show above.



(Click Here to view a high resolution video)

Display Item Form

In this section we are going to build the Display Form. In this form we are not going to delete any columns, however, we are going to remove the 'Close' button from the top and give the form a different name. 

Click on the Form's New button and fill the information as shown below. Select the 'Set as default form for the selected type' . Click Ok.



Now in Forms you should see  your new custom form. Click on the form. You should now be presented with the CustomDisplayForm code. Below are screenshots.




In the code right-click and choose 'Find…' from the drop-down list.  Type in 'gobackbutton1'. Below is what you are looking for.  Delete that code. I have also provide a copy of that code below.

<tr>
<td class="ms-toolbar" nowrap="nowrap">
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap="nowrap"><IMG SRC="/_layouts/15/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="nowrap" align="right">
<SharePoint:GoBackButton runat="server" ControlMode="Display" id="gobackbutton1"/>
</td>
</tr>
</table>
</td>
</tr>





Again, click Save and then Preview in Browser. Now, you should not see the Close button on the top.

Below is a video which walks  you through the process of deleting the top Close button and adding a title.



(Click Here to view a high resolution video)

Edit Item Form

In this section we are going to build the Edit form. In this form we are not going to delete any columns, however, make changes so that some of them cannot be edited. We are also going to remove the Save and Cancel buttons from the top and change the title.

Below is a table which shows which columns can and cannot be edited.



In the CustomEditForm.aspx code, for all the columns we want to setup as read only, we need to replace the Edit code with the Display code i.e. replace the Edit code shown below (both text and screenshot are provided)

<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Title<span class="ms-formvalidation"> *</span>
</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Title" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/>
<SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Title" ControlMode="Edit"/>
</td>
</tr>




With the Display code as shown below (both text and screenshot are provided)

<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Title</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<xsl:value-of select="@Title"/>
</td>
</tr>




Below is a screenshot of what the Edit view looks like when the Title column has been setup as display only.



Below is a video which walks  you through the process of editing the edit item form to force some of the fields to be in display mode only. In this video I have first purposefully left the Title column as it is and also copied the code over from the display form to show you both. Then I have made all the changes to only allow the Counselor Comment, Counselor Date and Approved by Counselor fields to be editable.



(Click Here to view a high resolution video)

Conclusion

In this article I have not described the use of the Current Status column that we created. This column is primarily used for workflows i.e. you can use that choice field to setup workflow conditions to perform desired actions. 
This article is to provide a quick, easy and little to no-code solution to create custom design forms for a SharePoint list or document library using only SharePoint Designer 2013. Once the custom forms have been built and set as default, it is at  your discretion to delete the original three forms.

See Also