Archive for the ‘Custom Form’ Category


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.

You want the default Add/Edit/Display forma of a SharePoint list to be customized using Infopath. Open the list, under the List header in the ribbon, you select Customize  Form option which opens your list form in Infopath designer. You  start editing it and once you do all the changes, publish it to see the changes in the list.

Now you want to deploy the same file to a different list in the same site or a different site. In the Infopath designer, under File menu select publish, you would be able to see the publish URL. You need to change this URL to point to your new list location. But unfortunately you cant do this anyway in the designer. You need to update this URL manually by updating the manifest file of the Infopath form. Below are the steps you need to follow..

  1. Under File menu select Save As option to save the Infopath form. You will be saving a .xsn file(In My case file name is Template.xsn).
  2. Now rename the file from .xsn to .cab(Template.xsn to Template.cab).
  3. Extract the file using winzip to a folder(My folder name is Template).
  4. In the files extracted open the file Manifest.xml.
  5. Search for your current site/list URL and replace it with the new site/list URL.
  6. Now we have the manisfest file updated pointing to the new site, we need to to make a cab file out of the extracted files.
  7. We will be using makecab.exe tool to create the cab file. I need to create a directive file. Below is the content of my ddf file(ddf.txt).

    ;************************************************************
    ; MSDN Sample Source Code MakeCAB Directive File
    ;************************************************************
    .OPTION EXPLICIT.Set CabinetNameTemplate=NewTemplate.XSN

    ;*****************************************************************
    ; Change DiskDirectoryTemplate to where you want the CAB/XSN saved.
    ;*****************************************************************

    .set DiskDirectoryTemplate=”C:\Users\chanakya.jayabalan\Desktop”
    .Set Cabinet=on
    .Set Compress=on

    ;*************************************************
    ; List all the files to add to the cab/xsn
    ;*************************************************

    “C:\Users\chanakya.jayabalan\Desktop\Template\Choices Data Connection.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\choices.xml”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Client Assurance.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Client Assurance1.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Client Assurance2.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Client Assurance3.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Client Assurance4.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Concepts, Programs, Projects and Initiatives.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Concepts, Programs, Projects and Initiatives1.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Concepts, Programs, Projects and Initiatives2.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Concepts, Programs, Projects and Initiatives3.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Concepts, Programs, Projects and Initiatives4.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\manifest.xsf”
    “C:\Users\chanakya.jayabalan\Desktop\Template\NewItem.xsl”
    “C:\Users\chanakya.jayabalan\Desktop\Template\SA Team.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\SA Team1.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\SA Team2.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\SA Team3.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\SA Team4.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\sampledata.xml”
    “C:\Users\chanakya.jayabalan\Desktop\Template\schema.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\schema1.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\schema2.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\schema3.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\schema4.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\template.xml”
    “C:\Users\chanakya.jayabalan\Desktop\Template\upgrade.xsl”
    “C:\Users\chanakya.jayabalan\Desktop\Template\view1.xsl”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending Sorted5.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending Sorted6.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending Sorted7.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending Sorted8.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending Sorted9.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending1.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending2.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending3.xsd”
    “C:\Users\chanakya.jayabalan\Desktop\Template\Week Ending4.xsd”

    ;*****************
    ; End Of The File
    ;*****************

  8. Run the command makecab.exe \f  C:\Users\chanakya.jayabalan\Desktop\ddf.txt.
  9. NewTemplate.xsn is the new template file that will be created.
  10. Now right click this file, select design & under File menu select publish. Now you would be able to see the publish URL pointing to your new site/list.
  11. Go ahead and publish the form.

While trying to customize the New/Edit/Display forms in a custom list using SharePoint designer, you may encounter any of the following errors

The solution for each of the above issue is given in the below support document.

http://support.microsoft.com/default.aspx?scid=kb;en-us;953271&sd=rss&spid=11373

Some times while solving one error you will end up with the other one. So follow the step provided for the new error you face.


We know most of the content in a SharePoint page are webparts. If you want to add a new webpart  in the page we normally use

Site Actions -> Edit Page

But in some cases the pages are not editable ie you will not find the Edit Page option in Site Actions menu (For example NewForm.aspx). In these cases you will try to edit the page in SharePoint Designer and add a webpart. But if you notice the page you opened in designer it also has a webpart (in our case List Form webpart in NewForm.aspx) in a webpart zone. So why cant we add a webpart to the same zone from the browser. Yes you can! You can get the edit mode of the page by just adding the below name value pair to the query string of the current page.

ToolPaneView=2


Example: http://servername/lists/listname/NewForm.aspx?ToolpaneView=2


I have tried  customizing the DispForm.aspx and once I view the form in browser i found the people editor values are not displaying properly. Instead some HTML code was displayed.And this happened only for the people editor controls where I have allowed multiple selection.

When I opened the form in the designer I found the XSL code for the particular people editor showed

<xsl:value-of select=”@Team_x0020_Members”/>

I have added another parameter disable-output-escaping=”yes” to that line. No my code read as

<xsl:value-of select=”@Team_x0020_Members” disable-output-escaping=”yes”/>

That have done the magic.