Pages

Saturday, March 7, 2009

customize sharepoint List forms

SharePoint has always been good for basic business forms. A custom SharePoint list can be configured to collect any type of data and SharePoint automatically generates the forms for adding new items, editing items and viewing items. In SharePoint 2007, the workflow capabilities make SharePoint lists an even more attractive foundation for basic business forms.

By default, most SharePoint lists and libraries include forms that are displayed when you want to add an item to, or edit or display an item in, that list or library. With Microsoft Office SharePoint Designer 2007, you can easily replace any of the default list forms with a custom list form that you design to meet your specific needs. After you create the custom list form, including the fields that you want, you can make the new form the default form for that list or library.

In order to manage the data you collect from the form submitters, you will often have a few extra columns (e.g. status, notes, etc.) that you don't want the user to fill in when submitting the form. Using SharePoint Designer you can create a customised version of the form for adding new items that does not have your extra management columns on it.

  1. Open your site in SharePoint Designer.

  2. Browse to your list and open the 'NewForm.aspx' web form.

  3. Go File > Save As... and give the form a new name such as 'NewForm2.aspx'.

  4. Delete the default List Form Web Part from the page.

  5. Go Insert > SharePoint Controls > Custom List Form.

  6. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.

  7. Click OK and a new Data Form Web Part is added with controls representing all the fields from the list.

  8. In the newly added Data Form Web Part, delete the rows containing fields not to be shown to the user (ensure that fields being removed are not required fields without default values as this would prevent the user from submitting the form).
    At this point, you can do other customisation such as rearranging the fields or add styles if you wish.

  9. Save the site.

  10. To give users access to your new form, publish a link to the NewForm2.aspx page. By using the Source query string parameter you can direct users back to where they came from after submitting the form.
    For example, if you publish the link on 'http://portal.example.com' then the URL to the form would be 'http://portal.example.com/Lists/YourList/NewForm2.aspx?Source=http://portal.example.com'.