Archive for the ‘InfoPath’ Category

Fahad Zia

InfoPath Forms Services Hidden Field Validation

I was unable to to suppress validation on a hidden field so here is what came up with, which doesn’t look like the best approach but works.
Shown below is the form in which “Employee” text field is mandatory and “Officer” dropdown is only required if “Get Approval” checkbox is true.

The “Section” under “Get Approval” checkbox is an “Optional Section” control with “Default settings” set to “Include the section in the form by default”. And under “Display” tab the “Conditional Formatting” is set as follows:

Note that I did not set “Cannot be blank” for the officer dropdown since this will not let the form submit even if it’s not visible. Instead I created the rules and conditions on the “Submit” button as shown below:

The validation that is set reads:
Submit the form when any of the following is true:

  1. Approval is required and Officer field is not blank
  2. Approval is not required and Employee field is not blank

The screenshots below show the settings.