Apply Compound Conditions with Rules Logic
Formsite’s Rules let form owners control the visibility of form items and page flow using answers to form questions. The logic settings let form owners say under what conditions items show or hide, and which page to show next. Some Rules need to check multiple answers or apply compound conditions, which adds complexity.
Examples of Compound Conditions
The term ‘compound conditions’ refers to any situation where the condition needs more than one answer to return true. Examples include:
- Checkbox items checking two or more answers
- Separate items with two or more answers
- Combination of AND and OR conditions (Item 1 answered “yes” AND item 2 answered “A” OR “B”)
Use a Hidden Field Helper
The solution for virtually every compound condition is to use a Hidden Field helper item. Any time where multiple rules need to contribute to the logic, use a Hidden Field with its default value instead.
For example, for the condition:
- Item 1 = Yes, AND
- Item 2 = A OR B
Since the Rules cannot use both AND and OR connectors (also known as “any” and “all”), the problem is setting a single item with that compound condition. The solution is to add a Hidden Field item in the form editor for the second part of the condition.
- Hidden Field with Default value = TRUE and Rule to show when Item 2 = A OR B
Setting the Hidden Field item with a default value and Rule means it will only appear on the form under that condition. That makes the new compound condition:
- Item 1 = Yes, AND
- Hidden Field = TRUE
Since the Hidden Field item is not visible, its Rules only affect whether it exists on the form and would not affect the visitor’s experience. Anything will work for the default value as long as it’s not blank.