How To Create A Form In Sharepoint 2013 Without Designer
Requirement: You have customized a SharePoint list form heavily. Now you got a new requirement to add a new field to the List, of course on the List form as well. Unfortunately, when you add a new column to the SharePoint list, custom forms have no effect – meaning a new column will not appear on custom forms in SharePoint!
So, This leads to create a new list form and do all customizations in the list form again from the scratch, isn't it? Well, Here is a trick to avoid rebuilding custom list forms when new fields are added to the list.
Step 1: Refresh the data source
- Open your custom form (Say, New.aspx) in SharePoint designer
- Click on "Refresh data source" link in "Data Source Details" pane.
- Not finding "Data Source Details" pane? Place the cursor under <SharePoint:DataFormWebPart> node, You'll find the "Data View Tools" Ribbon Group. Click on "Options" Tab and then click on "Data Source Details" button. This should bring the data source details pane.
This updates the <DataFields> node in the source code!
Step 2: Copy-Paste the similar field and update Field ID and Name
The next step is to copy-paste the existing similar field (In my case its a single line of text) and change the Field name and ID field's number which start with "FF"
- Locate a field of similar type. Copy between <TR> to <TR>. Here is my code
<tr> <td width="190px" valign="top" class="ms-formlabel"> <H3 class="ms-standardheader"> <nobr>Change Request Number</nobr> </H3> </td> <td width="400px" valign="top" class="ms-formbody"> <SharePoint:FormField runat="server" id="ff50{$Pos}" ControlMode="New" FieldName="ChangeNumber" __designer:bind="{ddwrt:DataBind('i',concat('ff50',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ChangeNumber')}"/> <SharePoint:FieldDescription runat="server" id="ff50description{$Pos}" FieldName="ChangeNumber" ControlMode="New"/> </td> </tr>
- Paste the copied code into the relevant place. Change the Title text of the field. Change "FieldName" to new field. (Internal name of the field!).
- Change the ID field: Each field ID in the SharePoint list form is named with the prefix "ff<Number>" such as "ff1″,"ff2", "ff3" and so on. Search for text "FF" in your source code. Get the highest FF number from the form. Change your pasted code's FF to the existing highest FF +1. E.g. In my case, I found a field with ID: FF49. So, I changed my code to FF50.
These steps must be repeated for all custom forms such as Edit Form, Display form separately!
Salaudeen Rajack
Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!
How To Create A Form In Sharepoint 2013 Without Designer
Source: https://www.sharepointdiary.com/2014/03/add-new-field-to-custom-list-form-sharepoint-2013.html
Posted by: daystol1941.blogspot.com
0 Response to "How To Create A Form In Sharepoint 2013 Without Designer"
Post a Comment