Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Create a custom list form
 

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 replace any of the default list forms with a custom list form that you design to meet your specific needs.

After you create a custom list form, you can use the WYSIWYG tools in Office SharePoint Designer 2007 to add or remove columns, change font formatting, or apply colors. When you do this, Extensible Stylesheet Language (XSL) (Extensible Stylesheet Language (XSL): An XML vocabulary that is used to transform XML data to another form, such as HTML, by means of a style sheet that defines presentation rules.) is inserted directly into the HTML. Although it is possible to edit the XSL directly in Code view, you can also use the formatting tools in Design view to apply XSL quickly and easily without knowing any XSL.

This article will show you where to find the default list forms, and how to create a copy of the default list form on which you will replace the default list form with the custom list form.

 Important   Do not delete the default List Form Web Part from any of the default pages such as DispForm.aspx, EditForm.aspx, and NewForm.aspx. Instead, you should hide the List Form Web Part by modifying its Web Part properties, as described in this article. Deleting the List Form Web Part may cause issues that require deleting the list and then re-creating it.

In this article


Locate the default list forms

Most SharePoint lists and libraries have list forms that are used to add a new item to, edit, or display an item in that list or library. The list forms are located in the folder that contains the associated list.

Although it is not necessary to locate the default forms before creating a custom list form, it can be helpful to know where they are located and to store your custom list forms in the same location. To find the default list forms for a list or library, do the following.

  1. If the Folder List isn't visible, on the View menu, click Folder List.

    Keyboard shortcut  To open the Folder List, press ALT+F1.

  2. For a SharePoint list, in the Folder List, locate the Lists folder. For a SharePoint library, locate the Shared Documents folder. If the Lists or Shared Documents folder is collapsed, click the plus sign (+) to expand it.
  3. Locate the list or library for which you want to create a custom list form. If the list or library list is collapsed, click the plus sign (+) to expand it.

    In the following illustration, the Announcements list has been expanded.

    List forms for a SharePoint list as they appear in the Folder List

By default, three form page files appear in the folder: DispForm.aspx, EditForm.aspx, and NewForm.aspx. A fourth file, AllItems.aspx, is the default Data View that displays the items in the list, as shown in the following illustration.

AllItems form page as it appears in the browser

 Note   Depending on the list, there may be multiple Data View pages in the folder, in addition to multiple form pages.

With Office SharePoint Designer 2007, you can create custom forms that replace the default New Item form, Edit Item form, or Display Item form by replacing the existing list view Web Part with a custom form Web Part.

The following three illustrations show the default list forms for an Announcements list.

  • The NewForm.aspx page displays the New Item form that appears when you add a new item to a list.

    NewForm.aspx page as it appears in the browser

  • The EditForm.aspx page displays the Edit Item form that appears when you edit an item in a list.

    EditForm.aspx page as it appears in the browser

  • The DispForm.aspx page provides the Display Item form that appears when you view a single item from a list.

    DispForm.aspx form page as it appears in the browser

Top of Page Top of Page

Replace the default list form with a custom list form

You begin by creating a copy of the ASPX page that has the default list form. Then you add a new custom list form to the page and hide the default list form.

  1. In the Folder List, click the plus sign next to Lists, and then click the plus sign next to the list that you are interested in — for example, click the plus sign for Announcements.
  2. Right-click one of the default forms such as DispForm.aspx, and then click Copy on the shortcut menu.
  3. In the Folder List, right-click the list, and then click Paste on the shortcut menu.

    If the default form was copied correctly, a file with a name like DispForm_copy(1).aspx appears.

  4. Double-click the newly copied file such as DispForm_copy(1).aspx to open the page in Design view.
  5. In Design view, click the default List Form Web Part to select it, and then press the RIGHT ARROW key.

    This will put the cursor immediately after the List Form Web Part but still inside the Web Part zone.

  6. On the Insert menu, point to SharePoint Controls, and then click Custom List Form.

    The List or Document Library Form dialog box opens.

    List or Document Library Form dialog box

  7. In the List or document library to use for form list, click the list or library for which you want to create a form.
  8. In the Content type to use for form list, click the content type for which you want to use the form. You may have only one choice if your list has only one default content type.

    Every list or library can be configured to allow multiple content types, which then appear in this dialog box in the Content type to use for form list. You can use a distinct set of custom list forms for each content type available for a list or library. For example, if your list has both a Press Releases content type and an Industry News content type, you can create and use two separate sets of custom list forms, one for each of the two content types.

    The advantage to using a separate set of custom list forms for each content type is that each custom list form can then be designed to display only the fields that are appropriate for that content type.

  9. Under Type of form to create, click the type of form that you want.
  10. To include a toolbar with the form, select the Show standard toolbar check box.

    The custom list form can include a toolbar to help users perform common actions for an item. The commands on the toolbar depending on the type of the form. For example, the toolbar for EditForm.aspx might look like the following illustration.

    EditForm.aspx toolbar

    But the toolbar for DispForm.aspx might look like this illustration.

    DispForm.aspx toolbar

  11. Click OK. The new custom list form appears on the page, directly below the default List Form Web Part.

    By default, the custom list form shows the default fields for the selected form type, along with any default controls for each field. For example, for the Announcements list, the Expires field has a date-picker control. Required fields, if any, are automatically indicated by an asterisk.

    Now you must hide the default List Form Web Part — do not delete this Web Part. This step ensures that the page's connection to the list remains intact, and that links in the site to this new form work correctly.

  12. Right-click the default List Form Web Part, and then click Web Part Properties.
  13. In the dialog box that appears, click the plus sign next to Layout, select the Hidden check box, and then click OK.
  14. You are now ready to preview the page in the browser.

Top of Page Top of Page

© 2009 Microsoft Corporation. All rights reserved.