banner



How To Create A Form In Sharepoint 2016

  • Piyush Agarwal
  • Updated date Mar 16, 2018
  • 32.6k
  • 3

This blog describes how to modify the layout of new, edit and view forms of SharePoint list using SharePoint Designer.

This blog describes how to create Custom new, edit, and view list forms and modify the layout as per your requirement.

When we create a Sharepoint list, it by default creates three forms; i.e,. Newform.aspx, Editform.aspx and Dispform.aspx.

Suppose, we create a list of four fields; i.e., First Name, Last Name, Designation, and Location.

The Newform.aspx will look like:

SharePoint

The Default Dispform.aspx looks like:

SharePoint

And The default Editform.aspx looks like:

SharePoint

Now, if we need to change the alignment or CSS of any of these forms then we will need to create a Custom list form using Sharepoint Designer.

Steps,

Go to the Sharepoint Designer and open the site and the list for which customs forms need to be created.

In the form section of the List page in Sharepoint Designer, click on New as shown in the screenshot below.

SharePoint

A pop up will appear asking which form --  i.e. new/edit/display --  we need to create.

We will be creating a new form for this blog, however, we can create other forms as well.

SharePoint

We would also provide a File Name and Set it as a default form and click OK.

SharePoint

Our Custom list form will appear in the Form section of the list in Sharepoint designer. We will click on the form and then edit it.

SharePoint

You will see a code like below.

SharePoint

  1. <table border= "0"  cellspacing= "0"  width= "100%" >
  2.     <tr>
  3.         <td width="190px"  valign= "top" class = "ms-formlabel" >
  4.             <H3class = "ms-standardheader" >
  5.                 <nobr>FirstName<spanclass = "ms-formvalidation" > *</span> </nobr>
  6.             </H3>
  7.         </td>
  8.         <td width="400px"  valign= "top" class = "ms-formbody" >
  9.             <SharePoint:FormField runat="server"  id= "ff1{$Pos}"  ControlMode= "New"  FieldName= "Title"  __designer:bind= "{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"  />
  10.             <SharePoint:FieldDescription runat="server"  id= "ff1description{$Pos}"  FieldName= "Title"  ControlMode= "New"  /> </td>
  11.         <tr></tr>
  12.         <td width="190px"  valign= "top" class = "ms-formlabel" >
  13.             <H3class = "ms-standardheader" >
  14.                 <nobr>LastName</nobr>
  15.             </H3>
  16.         </td>
  17.         <td width="400px"  valign= "top" class = "ms-formbody" >
  18.             <SharePoint:FormField runat="server"  id= "ff2{$Pos}"  ControlMode= "New"  FieldName= "u0yc"  __designer:bind= "{ddwrt:DataBind('i',concat('ff2',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@u0yc')}"  />
  19.             <SharePoint:FieldDescription runat="server"  id= "ff2description{$Pos}"  FieldName= "u0yc"  ControlMode= "New"  /> </td>
  20.     </tr>

Remove the <tr></tr> tags as highlighted in the screen shot above and then save the form and open a new form from the browser.

The layout of the CustomNewForm will change:

SharePoint

Similarly, remove the tr tags between designation and location.

The final form will look like this:

SharePoint

This is a very basic example of creating custom list forms using Sharepoint Designer.

Similarly, we can create Custom forms for Edit and Display forms as well and can set then as default forms.

We can also apply CSS to modify various fields which will be discussed in later blogs.

Hope you like it!

How To Create A Form In Sharepoint 2016

Source: https://www.c-sharpcorner.com/blogs/create-custom-new-edit-and-view-list-forms-using-sharepoint-designer

Posted by: furrwassaimmat.blogspot.com

0 Response to "How To Create A Form In Sharepoint 2016"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel