Validate Data
Forms that use a database or web service as their primary data source can send data back to that source through the Submit action. You can call the Submit action by choosing File → Submit or by clicking a button on the form assigned to Submit.

Figure 7-29. Checkbox in this dialog determines whether the database is queried at form load

Figure 7-30. Adding a button to refresh lists
Before submitting, however, you should validate the data to make sure the entries are valid for constraints in the database (or web service). InfoPath can validate fields using a variety of criteria. Problems are flagged and must be fixed before continuing, as shown in Figure 7-31.

Figure 7-31. InfoPath flags validation errors and highlights required fields
How to do it
To add validation criteria to a control:
Display the control’s properties and click Data Validation. InfoPath displays the Data Validation dialog, as shown in Figure 7-32.
Click Add. InfoPath displays the dialog box for validation criteria. Enter a condition that results in a validation error. For example, the settings in Figure 7-33 make CustomerID a required field.
Click OK, then preview the form and test the validation. ...
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