> ## Documentation Index
> Fetch the complete documentation index at: https://university.triggr-app.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional fields

> Show or hide a form field or section based on another answer, a client or org variable, or the client's environment.

A condition shows or hides a field, or a whole section, as the person fills in the form. Hidden fields are never required.

<Frame caption="Conditional fields: Laptop model shown only when Needs a laptop is ticked, and Team only once a department is chosen (1:23).">
  <video controls preload="none" playsInline className="w-full aspect-video rounded-xl" poster="/images/videos/studio-conditional-fields.jpg" src="https://mintcdn.com/triggr/GxrCQFDFNLmEMyJ1/images/videos/studio-conditional-fields.mp4?fit=max&auto=format&n=GxrCQFDFNLmEMyJ1&q=85&s=8243ce15aa02d5d3e3e218916483ba5a" data-path="images/videos/studio-conditional-fields.mp4" />
</Frame>

## Show a field when a box is ticked

Laptop model appears only when Needs a laptop is ticked.

<Steps>
  <Step title="Add the fields">
    Add a Checkbox with Field ID `needsLaptop` and Label `Needs a laptop`, then a Select with Field ID `laptopModel`, Label `Laptop model` and Required field ticked.
  </Step>

  <Step title="Add the condition">
    Click Laptop model. Under Conditional Rendering, click **Add Show Condition**, choose Form Field, Needs a laptop and Equals, type `true` and save.

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/forms/condition-editor.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=93ebd028acf2ef7ef0c87bae90062ba1" width="318" alt="The Conditional Rendering section of a field's properties with a Show when condition set to Form Field, Needs a laptop, Equals and the value true, and Add Show Condition and Add Hide Condition links." data-path="images/studio/forms/condition-editor.png" />
    </Frame>
  </Step>

  <Step title="Try it">
    Click **Preview**. Laptop model is hidden until the box is ticked.

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/forms/preview-condition-hidden.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=276dc3b64b1d2fae6058be64319cbe55" width="560" alt="A previewed form showing only an unticked Needs a laptop checkbox and a Submit button." data-path="images/studio/forms/preview-condition-hidden.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/forms/preview-condition-shown.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=bb248864ead95a2a560fff35c427a11d" width="560" alt="The same form with Needs a laptop ticked, now showing a required Laptop model dropdown and a Laptop delivery section, described Where should we send it?, with a Delivery address box." data-path="images/studio/forms/preview-condition-shown.png" />
    </Frame>
  </Step>
</Steps>

## Show a whole section

Click the edit icon on a section's title. Section Properties has the same Conditional Rendering and hides every field in the section; Laptop delivery above shows when Needs a laptop Equals `true`.

<Frame>
  <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/forms/section-properties.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=8a7b8bdca14ae3988a72192fdb6e1ee6" width="318" alt="Section Properties for Laptop delivery: Title, Description Where should we send it?, Display Order 1, Collapsible section ticked, Collapsed by default unticked, and a Show when condition of Form Field, Needs a laptop, Equals, true." data-path="images/studio/forms/section-properties.png" />
</Frame>

## How conditions work

A field or section shows only when all its show conditions match, and hides when any hide condition matches. Hide wins.

| Condition on | Compares | Checked |
| - | - | - |
| Form Field | Another field's answer | As the person answers |
| Client Variable | A variable of the person's client, by name | When the form opens |
| Org Variable | One of your org variables, by name | When the form opens |
| Client Environment | Cloud Only, On-Prem Only, Cloud + On-Prem Separate or Cloud + On-Prem AD Synced | When the form opens |

Client conditions need a form that [knows the client](/studio/forms/authentication); test them with **Share Form > Impersonate**.

| Operator | Matches when the answer |
| - | - |
| Equals, Not Equals | Is, or isn't, exactly the value. Text is case-sensitive. |
| Contains, Not Contains | Includes, or doesn't include, the value |
| Greater Than, Less Than | Is a bigger or smaller number |
| Is Empty, Is Not Empty | Is blank or has nothing chosen, or isn't |
| Has file, Has no file | Offered instead for a File Upload field |

* Compare a Select, Radio or Multi Select by the option's value, not its label: `macbook-air-13`, not `MacBook Air 13`.
* For a Checkbox, use Equals `true` or Equals `false`. Keep `true` and `false` for Checkboxes: on other fields, Equals `true` matches any answer.
* For a Multi Select, use Contains with one option's value. Contains matches part of a value, so choose option values that don't appear inside each other.

## What hidden fields send

| Hidden by | Required? | Sent to the workflow? |
| - | - | - |
| Its own condition | No | No: `ctx.params.<Field ID>` doesn't exist |
| Its section's condition | No | Yes, usually empty |

A field that's hidden and shown again keeps its answer. A template that names a missing field fails, so read optional answers in a [Code step](/studio/workflows/expressions#recipes): `ctx.params.laptopModel ?? ''`. Option workflows ([Dynamic options](/studio/forms/dynamic-options)) still see every answer.

## FAQ

<AccordionGroup>
  <Accordion title="My field never appears">
    Check the value is the option's value, not its label, and matches its capitals. For a Checkbox, use `true`.
  </Accordion>

  <Accordion title="“Missing or invalid variable: params.laptopModel”">
    The field was hidden, so it wasn't submitted. Read it with `ctx.params.laptopModel ?? ''` in a Code step, or branch on `needsLaptop` first.
  </Accordion>

  <Accordion title="A client variable condition doesn't work">
    The form doesn't know the client, or the variable name doesn't match exactly. Client conditions are checked when the form opens, not as the person answers.
  </Accordion>

  <Accordion title="Can I show a field when either of two answers is chosen?">
    Hide it for the other answers instead, since any one hide condition hides it: Hide when Department Equals `it`, and Hide when Department Is Empty.
  </Accordion>

  <Accordion title="“Error saving form - builder validation failed: field laptopModel: hideWhen condition 0 must reference a fieldId, clientVariableName, or orgVariableName”">
    A condition was added without choosing a field or variable. Fill it in or remove it with its ×.
  </Accordion>

  <Accordion title="“… references non-existent field: needsLaptop”">
    The condition points at a field that was deleted or given a new Field ID. Choose the field again.
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.