The art of dynamic required fields

Required fields are an important part of any InfoPath form. They are used to ensure that the form contains the necessary data elements to adequately describe a complete entity or business process. Typically, this is done at the field level during the initial design of a form. Many times this may not provide an ideal solution for many types of dynamic forms. In these scenarios, a field may become conditionally required based on other data within the form. This can be accomplished using Data Validation.

For example, if we start with a data source that contains the following fields.

When added to the form this contains a list of company names in the drop down box and a text box that contains contact names.

Normally, the contact name isn’t a required field. It’s up to the person completing the form as to whether they would enter a contact name. However, in this example, when the company name of ‘Enormous Company’ is selected the contact name becomes required. This can be done by setting properties within data validation.

Within the form select the contact name properties.

Select the Data Validation button

And then ‘Add’ the following data validation

When the form is run and the ‘Enormous Company’ is selected notice that the field is now required.