Basic Show/Hide Rules
What Is Conditional Logic?
Conditional logic lets you create dynamic forms that change based on how a respondent answers. Instead of showing every field to every person, you can show or hide specific fields, sections, or pages depending on previous answers. This creates a more personalized experience and keeps your forms concise.
Common examples include:
- Showing an "Other (please specify)" text field only when someone selects "Other" from a dropdown.
- Hiding shipping address fields when a customer selects "Digital delivery."
- Displaying follow-up questions only when a specific answer is given.
Creating Your First Rule
Follow these steps to set up a basic show/hide rule:
- Open your form in the editor and click on the field you want to conditionally show or hide.
- In the right-side settings panel, find the Logic tab.
- Click Add Condition.
- Configure the rule using three parts:
- If: Select the field that triggers the condition (e.g., "How did you hear about us?").
- Operator: Choose how the value is evaluated (e.g., "equals", "does not equal", "contains", "is not empty").
- Value: Specify the answer that triggers the action (e.g., "Other").
- Set the Action to either Show this field or Hide this field.
- Click Save.
The If/Then Pattern
Every conditional rule in WittyForm follows an "if/then" pattern:
IF [field] [operator] [value], THEN [show/hide] [target field].
Here are some real-world examples:
- IF "Employment Status" equals "Employed", THEN show "Company Name" field.
- IF "Do you have dietary restrictions?" equals "Yes", THEN show "Please describe your restrictions" field.
- IF "Country" equals "United States", THEN show "State" dropdown.
Available Operators
The operators available depend on the field type of the trigger field:
Text and Email Fields
- equals: Exact match.
- does not equal: Does not match the value.
- contains: The answer includes the specified text.
- does not contain: The answer does not include the text.
- is empty: No answer provided.
- is not empty: Any answer was provided.
Choice Fields (Dropdown, Radio, Checkbox)
- equals: The selected option matches.
- does not equal: A different option is selected.
- contains: The selection includes the specified value (useful for multi-select fields).
- does not contain: The selection does not include the specified value.
- is empty: No option was selected.
- is not empty: At least one option was selected.
Number Fields
- equals: Exact number match.
- does not equal: Different number.
- greater than: Above a threshold.
- less than: Below a threshold.
- is empty: No value entered.
- is not empty: A value was entered.
Multiple Conditions on One Field
You can add multiple conditions to a single target field. When you do, you choose how the conditions relate:
- ALL conditions must be true (AND): The field is shown/hidden only when every condition is met.
- ANY condition can be true (OR): The field is shown/hidden when at least one condition is met.
Testing Logic in Preview
Always test your conditional logic before publishing. Click the Preview button in the editor toolbar to open a live preview of your form. Fill out the trigger fields and verify that:
- The target fields appear and disappear as expected.
- The transitions are smooth (fields animate in/out).
- Required validation still works correctly on conditionally shown fields.
- Hidden fields do not submit data (WittyForm automatically excludes hidden fields from responses).
Tips and Best Practices
- Hidden fields are not required: When a field is hidden by conditional logic, its "required" validation is automatically bypassed. You do not need to manage this manually.
- Keep it simple: Start with basic show/hide rules and add complexity gradually. Overly complex logic can be hard to maintain.
- Name your fields clearly: Descriptive field labels make it easier to set up and debug conditional rules.
- Test every path: If your form has multiple conditional branches, test each one to make sure every user journey works correctly.