Customizing Forms
To prevent members from opening a service request from the form library and accidentally submitting the request again, you might want to disable the Submit button whenever the form is opened from SharePoint.
You control the appearance of items on InfoPath forms using conditional formatting, but getting conditional formatting to do what you want can be tricky. Conditionally disabling the Submit button involves these major tasks:
Add a checkbox to enable or disable other controls.
Set conditional formatting on those controls based on the checkbox setting.
Create rules that set the checkbox value and submit the form.
Test the form.
Hide the checkbox once the form is working correctly.
The following sections demonstrate those tasks using the Service Request example.
Adding Controls
To add a new checkbox control on the form:
Open the template in Design mode.
Choose Tools → Submit Options, clear the "Show the Submit menu item and the Submit toolbar" button, and click OK. You can't enable or disable menu items from a form so you must remove the menu item if you want to control access to Submit.
Display the Data Source task pane and click "Add a Field or Group" at the bottom of the pane. InfoPath displays the Add Field or Group dialog box.
Add a Boolean field named
DisableSubmit, as shown in Figure 10-8. Choose OK; InfoPath adds an element to the form's XML schema.Drag
my:DisableSubmitfrom the task pane onto the form. InfoPath creates a checkbox control on the form.
Figure 10-8. Adding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access