Complex Conditions (AND/OR)
Basic show/hide rules use a single condition: "if X then show Y." But real-world forms often need more nuanced logic. WittyForm lets you add several conditions to one rule and choose whether all of them or any of them must be true, so you can build the logic your form requires.
AND Conditions
With the all setting a rule requires every condition to be true to activate. If any single condition is false, the rule does not fire.
Example: Show a "Schedule a Demo" field only when the respondent selects "Enterprise" plan AND their team size is greater than 50.
IF:
Plan equals "Enterprise" ← condition 1
AND Team Size greater than 50 ← condition 2
THEN:
Show "Schedule a Demo" fieldTo set this up in the builder:
- Select the target field ("Schedule a Demo").
- Open Conditional Logic in the settings panel.
- Click Add Condition and configure the first rule (Plan equals Enterprise).
- Click Add Condition again. The second condition is joined by AND by default.
- Configure the second rule (Team Size greater than 50).
Both conditions must be satisfied simultaneously. If the respondent selects Enterprise but enters a team size of 30, the field remains hidden.
OR Conditions
With the any setting a rule requires at least one condition to be true. If any condition is true, the rule fires.
Example: Show a "Dietary Restrictions" field when the event type is "Lunch" OR "Dinner."
IF:
Event Type equals "Lunch" ← condition 1
OR Event Type equals "Dinner" ← condition 2
THEN:
Show "Dietary Restrictions" fieldTo switch from AND to OR:
- After adding multiple conditions, find the rule's match setting (all / any).
- Switch it from all (AND) to any (OR).
- Every condition in the rule now uses OR logic.
One Rule, Several Conditions
A single rule can hold as many conditions as you need. The AND/OR toggle applies to the whole rule at once: every condition in the rule is joined by the same operator. Choosing all means each condition must be true (AND), and any means at least one condition must be true (OR).
Example: Show a "Schedule a Demo" field when the plan is "Enterprise" AND the team size is greater than 50 AND the budget is greater than 10000. Add all three conditions to the rule and leave the toggle on all.
If you need both AND and OR in the same decision (for example, plan is Pro or Enterprise and billing is Annual), split it across more than one field or restructure it. Because a rule uses one operator for all of its conditions, mixing AND and OR inside a single rule is not supported. Often the cleanest approach is to add a hidden helper field whose own conditions resolve part of the logic, then reference that field in the next rule.
Multiple Rules on One Field
A field can be the target of more than one rule. If any show rule matches, the field appears; if any hide rule matches, the field is hidden. This lets you express several independent conditions for showing the same field without combining them into a single rule.
Performance Considerations
Conditional logic is evaluated in real time as respondents interact with the form. For most forms, this is instantaneous. However, extremely complex setups can impact responsiveness:
- Keep conditions reasonable per field: A large number of conditions on a single field can cause noticeable lag on low end devices.
- Split complex logic across fields: If a single rule is getting hard to read, move part of the decision onto a separate helper field and reference it.
- Minimize cross-page references: Conditions that reference fields on other pages are slightly slower because the engine must look up values from non-visible pages.
- Use specific operators:
Equalsis faster thanContainsbecause it does not require scanning the full string.
Debugging Tips
When conditions do not behave as expected, use these techniques to diagnose the issue:
Preview Mode
Open the form in Preview and interact with it as a respondent. Watch which fields appear and disappear. This is the fastest way to spot issues.
Condition Indicator
In the builder, fields with conditional logic show a small lightning bolt icon. Hover over it to see a summary of the conditions. If the summary does not match your intent, click the field to edit the conditions.
Simplify and Isolate
If a complex condition is not working, temporarily remove conditions until you find the one causing the issue. Start with a single condition that you know should work, verify it, then add conditions back one at a time.
Check Field IDs
A common mistake is referencing the wrong field, especially when you have similarly named fields (e.g., two fields both labeled "Name"). Verify the field ID in the condition matches the intended source field.
Watch for Hidden Field Values
Remember that when a field is hidden by a condition, its value is cleared. If another condition references that hidden field, it will evaluate against an empty value. This can cause unexpected behavior in chains of dependent conditions.
Tip: Document your conditional logic in the form's internal notes (accessible in Settings > Notes). A written description of each rule helps you and your team understand the logic when revisiting the form months later.