An InfoPath button’s action may be configured as either a submit button or as “rules and custom code”. The form may be submitted via either mechanism, but there is a subtle difference for how validation (like ensuring that the user has completed all required fields, etc) is done depending on which option you choose. Specifically, if the button is set to be a submit button, the validation will be checked before the submit rules are processed. If the button is set to be “rules and custom code”, the rules will fire in order and the form’s validation will only be checked when it reaches the submit action.
This is significant. It means the difference between processing rules any time the user clicks the button, whether or not the form is filled in correctly, or only processing the rules if the validation checks out ok.
Since the above is a little confusing, here’s an example:
Consider the following form:
In the above are form, there are two submit buttons. Both submit the form. The first button has its action set to submit. The second has its action set to rules and custom code.
The following are the submit options for the form:
Note that it is using rules for the submit.
And here are the rules:
The first button is simply configured as a submit button:
And, the following dialog is the properties of the second button:
Note that the action is set to rules and custom code.
And, the following are the rules configured for that button:
Note that the above rules are the same for both buttons. But again one button’s action is set to submit and the rules are configured through the submit. The other button has its actions set to rules and custom code. Again, even though both buttons are processing the same rules due to the difference in actions, but there’ll be a difference in how the form is validated. Or rather, when the form is validated.
The following shows what happens when a text values input into the number fields, and the submit button is clicked that has its action set to submit. Again, the submit rules specify that the text field should have a value the ABC, and then the form should be submitted.
Note in the above, the text field is still empty. Even though the rules said to set the text field and then submit, since the rules have been processed as part of the submit options the validation was checked before attempting to execute the rules.
The following shows what happens when a text values input into the number fields, and the submit button is clicked that has its action set to rules and custom code. Again, the submit rules specify that the text field should have a value the ABC, and then the form should be submitted.
Note that in the above, the text field now has a value. Since the options were carried out as simply part of the button’s rules, the validation did not occur until the submit action was triggered. Which in this case was after the text field was set to ABC.