Individual New,Edit and Display forms for SharePoint using infopath forms

Posted: June 20, 2013 in Custom Form, Infopath, Sharepoint 2010

Customizing the SharePoint forms using Infopath is easy in SharePoint 2010. You have a “Customize Form” option under List Tools -> Lists in the ribbon when you are in the list view. Below screenshot shows that option (highlighted in red).

listview

On selecting this option, the form(Edit) is opened in Infopath Designer. Here you will be doing the changes in one infopath form(Edit) but, once you publish the form, the changes will be reflecting in all the three forms (New/Display/Edit).

So what if you want to edit three different forms in three different ways? Say New form should have all columns displayed, edit form should have some fields disabled where user cannot modify the values and display form having a different layout altogether.

Infopath solves this purpose by providing Views. We will be creating 3 views for each of the forms (New/Edit/Display). Follow the below steps to create separate views for each form.

  1. In the InfoPath designer, where your form is opened, , click on Page Design tab on the ribbon.
  2. You would be able to see the list of views available as a drop-down and also an option to create New View. You will be already having a view named Edit item (default) displayed in the drop-down.6581
  3. Already having a view for Edit form, we have to create 2 new views for New & Display. Click on New View.
  4. In the pop up opened type the name of the view(say Display Item) and click OK.
  5. Now you have an empty view, where you can add fields(from right side pane displaying fields from datasources), modify the layouts, adding rules, hiding columns. The changes you do in this view is going to affect only this view. If you want to replicate the views, just select all & copy the contents from one view & paste it in your new view.
  6. You can create another view (New Item) following the steps 3-5.
  7. Once you have created the views and done with your changes, publish the form.
  8. Now having 3 views for 3 different forms, you need to make your SharePoint list aware that which form to use which view.
  9. Open the list in SharePoint Designer, in the lists detail page, under Forms section, generally you will see DispForm.aspx, NewForm.aspx, EditForm.aspx. In addition to that since you have edited this list in infopath you will see 3 more forms namely displayifs.aspx, newifs.aspx & editifs.aspx.
  10. You need to set your views for each of this form. For each of the forms do the following steps.
  11. Open the form, select the form(highlighted in below snapshot), right click and select properties.6582
  12. In the properties window opened, under Misc header, set the DefaultView value to the view name you have created.
  13. You will be setting the values as below
    Form Name Default View Name
    displayifs.aspx Display Item
    editifs.aspx Edit item
    newifs.aspx New Item
  14. Now browse the list in IE to see different views set for different forms.
About these ads
Comments
  1. Keith Shankle says:

    Great article on how to customize the views and how to make them work in SPD 2010. I am currently working in Office 365 2013. I created 3 views, New Item (default) Edit Item, and View form. Then when I go to SPD 2013 I cannot find the properties. I have displayifs, editifs and newifs but I cannot figure out how to assign a view to each one of the ifs files. Have you had any luck in making this work in 2013?

    Thanks
    Keith

  2. Adrian says:

    Perfectly answered my question. This common need is not obvious in any MS documentation.

  3. PeteM says:

    Gr8!!! It solved my “3 days around this issue” problem! Thanks!

    • PatK says:

      Would be WONDERFUL is you would actually explain how to edit ONLY the newform.aspx (vs the edit form). This is majorly uncovered. There seems absolutely no way to modify the newform (for example, when I want to collect ONLY a small bit of data on a new item, and workflows populate other columns/fields for me. I do not wish to present these “other” fields on the new item form.

      • Pat,

        If you just need to hide some of the columns in the newform.aspx, then I would suggest using a content editor webpart & add some jquery code to hide the unwanted columns. Below is a sample code

        $(‘nobr:contains(“Status”)’).closest(‘tr’).hide();

        This code would hide a column whose display name is “Status”.

        Hope this helps.

  4. Derik Harris says:

    Like Keith, I can’t find a way to do this in SharePoint 2013 either! Anyone found a way??

  5. James says:

    I’ve created my New and Display views in InfoPath 2010. However, when I open the forms, in SP Designer 2010, I cannot get any properties to display. Also, when I set a default value on one view it applies the default value to all views. What am I doing wrong?

  6. James says:

    For whatever reason, I had to add a new InfoPath form webpart to the form pages. However, when I set a default value on one view it applies the default value to all views.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s