> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formflows.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional logic

> Show or hide fields, change required state, and jump between pages based on a respondent's answers.

Conditional logic lets you build forms that adapt in real time as respondents fill them out. Instead of showing every field to every respondent, you can reveal relevant questions only when they're needed, skip irrelevant pages, and adjust which fields are required based on earlier answers.

## What you can do with conditional logic

* **Show or hide a field** — reveal a follow-up question only after a specific answer
* **Show or hide a page** — skip entire form pages for respondents who don't need them
* **Mark a field as required or optional** — make a field mandatory only in certain situations
* **Jump to a page** — send respondents directly to a non-sequential page based on their answers (branching)
* **Show or hide a section** — collapse a group of fields when they're not relevant

## Rule structure

Every conditional logic rule follows the same structure:

```
IF  [field]  [operator]  [value]
THEN  [action]  [target]
```

For example:

```
IF  "How did you hear about us?"  equals  "Other"
THEN  Show  "Please describe"
```

You can also combine multiple conditions:

```
IF  "Country"  equals  "United States"
AND  "State"  is not empty
THEN  Show  "Zip code"
```

## Operators

The available operators depend on the field type being evaluated.

| Operator                        | Applicable field types             |
| ------------------------------- | ---------------------------------- |
| **Equals**                      | All types                          |
| **Does not equal**              | All types                          |
| **Contains**                    | Short text, Long text, Email, URL  |
| **Does not contain**            | Short text, Long text, Email, URL  |
| **Starts with**                 | Short text, Long text, Email, URL  |
| **Is empty**                    | All types                          |
| **Is not empty**                | All types                          |
| **Is greater than**             | Number, Rating, Slider, Date       |
| **Is less than**                | Number, Rating, Slider, Date       |
| **Is greater than or equal to** | Number, Rating, Slider, Date       |
| **Is less than or equal to**    | Number, Rating, Slider, Date       |
| **Is one of**                   | Checkboxes, Multi-select, Dropdown |
| **Is not one of**               | Checkboxes, Multi-select, Dropdown |
| **Includes all of**             | Checkboxes, Multi-select           |
| **Before**                      | Date, Date range                   |
| **After**                       | Date, Date range                   |

## How to add a rule to a field

<Steps>
  <Step title="Open the form builder">
    Navigate to your form and click **Edit** to open the builder. Make sure the form has at least two fields — a source field whose value will be evaluated, and a target field or page that will be affected by the rule.
  </Step>

  <Step title="Select the target element">
    Click the field, section, or page you want to control with logic. This is the element that will be shown, hidden, or changed as a result of the rule.

    <Note>
      Logic is always defined on the **target** element — the thing you want to show or hide — not on the source field whose answer triggers the rule.
    </Note>
  </Step>

  <Step title="Open the Logic panel">
    In the settings panel on the right, click the **Logic** tab. If no rules exist yet, you'll see an empty state with an **Add rule** button.
  </Step>

  <Step title="Set the default visibility">
    Choose whether the target element is **visible by default** or **hidden by default**. This determines its state before any rules are evaluated — typically you'll hide the target by default and reveal it only when conditions are met.
  </Step>

  <Step title="Add a condition">
    Click **Add rule**, then configure the condition:

    1. In the first dropdown, select the **source field** — the field whose value will be evaluated.
    2. In the second dropdown, select the **operator** (e.g., "equals", "contains", "is greater than").
    3. In the third input, enter or select the **comparison value**.
  </Step>

  <Step title="Set the action">
    Choose what happens when the condition is true:

    * **Show** — make the target visible
    * **Hide** — make the target invisible
    * **Require** — mark the target field as required
    * **Make optional** — remove the required state from a field
    * **Jump to page** — skip ahead or back to a specific page (only available on Page targets)
  </Step>

  <Step title="Combine conditions (optional)">
    To add a second condition to the same rule, click **Add condition**. Choose whether the conditions are combined with **AND** (both must be true) or **OR** (either can be true) using the toggle between conditions.

    You can add up to 10 conditions per rule and multiple rules per field.
  </Step>

  <Step title="Save and preview">
    Click **Save** in the builder toolbar, then open **Preview** to test the form. Trigger the condition you configured and confirm the target element responds as expected.
  </Step>
</Steps>

## Combining multiple conditions

When a rule has more than one condition, the **AND / OR** operator controls how they are evaluated together.

**AND** — all conditions in the group must be true for the action to trigger:

```
IF  "Plan type"  equals  "Enterprise"
AND  "Team size"  is greater than  50
THEN  Show  "Dedicated onboarding request"
```

**OR** — the action triggers if any one condition is true:

```
IF  "Role"  equals  "Manager"
OR  "Role"  equals  "Director"
THEN  Show  "Budget approval section"
```

You can mix AND and OR by creating separate rules on the same target. Each rule is evaluated independently, and the most permissive result wins — if any rule says "show", the element is shown.

## Common examples

<AccordionGroup>
  <Accordion title="Show an 'Other' text box when 'Other' is selected">
    This is the most common conditional logic pattern. Use it any time you have a radio button or dropdown with an "Other" option and want to collect details.

    1. Add a **Radio buttons** field with your options, including "Other".
    2. Add a **Short text** field below it, labeled "Please specify".
    3. Select the **Short text** field and open its **Logic** tab.
    4. Set default visibility to **Hidden**.
    5. Add a rule: IF `[Radio field]` equals `Other` THEN **Show**.
    6. Optionally add a second rule: IF `[Radio field]` equals `Other` THEN **Require**.

    Now the text box only appears — and only becomes required — when "Other" is chosen.
  </Accordion>

  <Accordion title="Skip a page based on respondent role">
    Use page-level logic to route respondents through different paths within a single form.

    **Scenario:** A form has three pages. Page 2 is only relevant for managers. Respondents who are not managers should jump from page 1 to page 3.

    1. On **Page 1**, add a **Dropdown** field: "What is your role?" with options including "Manager" and other roles.
    2. Click **Page 3** in the page list on the left sidebar to select it as the target.
    3. Open the **Logic** tab and set the page's default to **Visible**.
    4. Add a rule: IF `[Role field]` does not equal `Manager` THEN **Jump to page** `Page 3`.

    Respondents who aren't managers skip Page 2 entirely. Their submission will not include any responses from that page.
  </Accordion>

  <Accordion title="Make a field required only in certain cases">
    Some fields should only be mandatory based on context — for example, a "Company name" field that's required for business accounts but optional for individuals.

    1. Add a **Radio buttons** field: "Account type" with options "Individual" and "Business".
    2. Add a **Short text** field: "Company name". In its base settings, leave it as **not required**.
    3. Open the **Logic** tab on the Company name field.
    4. Add a rule: IF `[Account type]` equals `Business` THEN **Require**.

    The field is always visible but only enforces completion when "Business" is selected.
  </Accordion>

  <Accordion title="Show a section based on a numeric threshold">
    Use the greater than / less than operators to trigger logic based on numeric responses.

    **Scenario:** Show a "Volume discount" section if the respondent enters a quantity greater than 100.

    1. Add a **Number** field: "Quantity".
    2. Add a **Section** below it titled "Volume discount options".
    3. Select the section and open **Logic**. Set default to **Hidden**.
    4. Add a rule: IF `[Quantity]` is greater than `100` THEN **Show**.
  </Accordion>
</AccordionGroup>

## Order of evaluation

<Note>
  Rules on the same target element are evaluated from top to bottom in the order they appear in the Logic panel. If two rules conflict — for example, one says "Show" and a later one says "Hide" — the **last matching rule wins**. Drag rules to reorder them and control which takes precedence.

  When no rules match, the element returns to its **default visibility** state. Keep this in mind if your form has complex branching: always set the default state explicitly rather than relying on rule order alone.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Field types" icon="list" href="/guides/field-types">
    Learn about all available field types and their options.
  </Card>

  <Card title="Workflow builder" icon="diagram-project" href="/guides/workflow-builder">
    Trigger automated actions when conditions are met after submission.
  </Card>
</CardGroup>
