
# Conditional Logic

Conditional logic hides a field until an earlier answer makes it relevant. A form that would otherwise ask everyone everything instead asks each person only what applies to them, which makes it shorter and easier to finish.

## Adding a Condition

1. Select the field you want to show or hide.
2. Click **Add Condition** in the field settings.
3. Choose the field the condition watches, and the value to compare against.
4. Save the condition.

The field is hidden until the condition is met.

## Comparisons

| Comparison | Matches when the watched field |
|---|---|
| **is equal to** | Exactly matches the value |
| **is not equal to** | Is anything other than the value |
| **is greater than** | Is numerically above the value |
| **is greater than or equal to** | Is numerically at or above the value |
| **is less than** | Is numerically below the value |
| **is less than or equal to** | Is numerically at or below the value |
| **contains** | Contains the value somewhere in its text |
| **does not contain** | Does not contain the value anywhere in its text |
| **is empty** | Has no value |
| **is not empty** | Has any value at all |

**is empty** and **is not empty** are the two that take no comparison value; the box for it disappears when you pick either.

## What to Use It For

### Asking Follow-Up Questions

Keep the detail out of sight until it is needed. If "Do you have allergies?" is answered **Yes**, show the field asking which ones. If payment type is **Check**, show the check number field.

### Branching

Send different people down different paths. A form serving several kinds of respondent can ask each group its own set of questions, and skip the sections that do not apply.

### Varying What Is Required

A field only has to be filled in when it is showing, so a condition can make a question mandatory in some circumstances and absent in others. Ask for a phone number only on urgent requests, or for supporting documentation only above a certain amount.

## Tips

- Keep each condition simple. Several straightforward conditions are easier to follow later than one intricate one.
- Fill the form in yourself along every path, including the ones that only some respondents reach.
- When a field appears partway through, its help text should explain why it is being asked.
- Do not hide anything a respondent needs to see behind a condition they might not meet.

## Related

- [Sections](/docs/forms/sections) - splitting a long form into tabs
- [Field Types](/docs/forms/field-types) - the fields a condition can watch
- [Form Builder](/docs/forms/form-builder) - where field settings live
