SharePoint 2010 InfoPath List Form – A Fix
In SharePoint 2010 (Beta), a SharePoint list can be created, and a InfoPath form can be quickly created as an interface to the list, instead of using those default forms that aren’t very easy to customize. I was at a client site last week, teaching SharePoint 2010, and we noticed an issue with the InfoPath form once it has been created. It is missing those standard fields “Created”, “Created By”, “Modified” and “Modified By” that usually show on a list form. In this blog post, I will explain the issue I’m referring to, and show you how to fix it.
This is what a non-customized SharePoint 2010 list form looks like:
Notice the extra “Created” and “Last Modified” information at the bottom of the Edit Form and the Display Form, but NOT on the New Form. These fields do not exist on the new form, because there is no data for them until after the item has been created.
The problem is that when you convert this list form into an InfoPath form, you lose the Created and Last modified information at the bottom, as so:
- In the list tab of the ribbon, click Customize Form:
- Click the Quick Publish button in the toolbar at the top, the little lightning bolt:
- After the form is published, close InfoPath.
- Try opening, editing or creating new forms in the list, and you’ll notice that they are now InfoPath forms, BUT with that Created and Last Modified info missing, as so:
It is easy to add the missing fields to the InfoPath form, but they need to be configured so that they are not displayed on the NEW form. Insert a section in the form, and put the 4 fields in there, and set conditional formatting so that the section is not displayed when the ID field is blank.
Here’s how to do it:
- Click to Customize Form again.
- In the InfoPath form, insert a section at the bottom of the form, and type the text as seen in a default list item view, like this:
- Insert the proper fields from the Fields pane on the right, so that the section looks like this:
(The field names that I inserted are “Created”, “Created By”, “Modified”, “Modified By”
- Select the section, by clicking the word “Section”. Now the rule can be applied, for the conditional formatting. Click Add Rule in the ribbon. Create a new rule so that if the ID field is blank, the whole section is hidden.
- Click the Quick Publish button again, close InfoPath, and now take a look at the form’s behavior. Now the New Form will not display that section at all, and Edit and Display forms will show the appropriate information. Done.