Tuesday, December 15, 2009

Working with a List Input Form

When you have a or document library it is sometimes useful to be able to modify the input forms. You may wish to add browser side validation, AJAX lookup fields, or other options.

The first step is to open your site in SharePoint Designer, navigate to your list, then the Forms folder, and open the New or Edit page. In most lists you'll need to update both, but in Document and Picture libraries you just need to update the Edit page.

On this page you'll see the web part containing the list input fields. Unfortunately you can't edit this web part. Right click on it, select “Web Part Properties”, expand Layout and check the Hidden box. You can't delete this web part or you will have problems with the page, but you can hide it. Next go to Insert on the menu bar, choose “SharePoint Controls” and then “Custom List Form”. Select your list, content type and if this is for the New page or the Edit page type of form. This will place a new web part on the page that you can modify.

It is helpful at this point to right-click on the new web part, choose “Show Common Control Tasks” and on the pane that pops out check the “Show with sample data” check box.

From here you can add JavaScript validation, AJAX lookups, HTML, or whatever else you may need.