I designed a form for a client that had several different views, and I needed a way to display a specific view when the form was opened. This was easy, but took me a bit to figure out.
- Go to Tools > Form Options.
- Click the Open and Save option.
- Click the Rules button, and add rules and actions to switch views.
With this method, I was able to set a field on form submittal to indicate which view was last active. When the submitted form was re-opened, I was able to use a conditional rule to switch to that last active view.
Tags: InfoPath, SharePoint
If you’ve used the InfoPath Contact Selector before, you might have seen that it does not support validation like other InfoPath controls do. There is no option on the Properties dialog for the control to make it a required field. To work around this, I used a combination of rules and conditional formatting to prevent the form from being submitted if the control does not have a value.
The easiest way to do this is to create conditional rules in the Submit Options dialog:
- Configure your form and add a Contact Selector control (see this article for instructions).
- Go to Tools > Submit Options.
- Make sure that Allow Users to Submit this Form is checked.
- Click the option to Perform custom action using rules.
- Click the Rules… button.
- In the Rules dialog, click the Add… button.
- In the Rule dialog, click the Set Condition… button.
- In the Condition dialog, pull down the first dropdown, choose Select a field or group…, and drill down and choose the DisplayName field from your data connection. Select is blank in the second dropdown.
- Click the And> button to add a second condition.
- In the last dropdown on the first condition, change it from And to Or.
- In the second condition, select the DisplayName field again, and choose is not present for the condition. Your two conditions should look like this:
-
- Click OK. In the Rule dialog, do not add any Actions. Check the box to Stop processing rules when this rule finishes.
- Make sure that this rule appears first in the list of Rules.
The only downside to this approach is that there is no visual to the user, since InfoPath Forms Services does not support showing a dialog message. The form will just not do anything. To get an even better user experience, You can hide the Submit option from the Toolbar, and use your own Submit buttons with Conditional Formatting:
- Drag a button on the page.
- Right-click and choose Conditional Formatting….
- Click Add… to add conditions.
- In the Condition dialog, add the two conditions in steps 8-11 above, and choose Disable this Control.
Now, your submit button will be disabled until the user picks a person.
Tags: InfoPath, SharePoint
I ran into a situation with some custom InfoPath Document Information Panels where I was getting schema validation errors like this one because of a Business Data Column I added to a document library:
“…{guid}ColumnName is unexpected according to content model of parent element ‘documentManagement’.”
You might run into this in the following situation:
- You create the DIP on a Site Content Type.
- You configure a document library to use your Site Content Type.
- You add a custom column to the Document Library (and subsequently to the List Content Type (the local instance of your site content type that is applied to the list)).
In this situation, your Document Information Panel was created without the knowledge of this extra column, and does not have a field in its data source schema for this column. What I believe is happening is that when attempting to view the DIP, SharePoint is passing all the columns on the document library to the InfoPath form, and the form is not expecting this extra column, so it chokes (very lame, Microsoft).
To get around this:
- Edit the DIP on the List Content Type (List Settings, click content type name, Document Information Panel Settings, Edit this Template link)
- Once the form loads in InfoPath, choose Tools > Convert Main Data Source…
- Enter the absolute url to your document library (e.g. http://yoursitecollection/subsite/your doc library name), and click Next.
- Finish the wizard and view your Data Source. Expand the nodes and you should see the extra list column appear now.
This is also a great way to update the DIP on your List Content Type, especially if you have locally overridden the Optional/Required/Hidden settings on columns from the parent Site Content Type.
This workaround kind of defeats the whole point of setting the Panel at the Site Content Type level, but that’s the only way I could get it to work.
Tags: Document Information Panel, InfoPath, SharePoint