Skip to main content

Documentation Index

Fetch the complete documentation index at: https://osforms.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Conditional logic lets you show or hide fields based on answers to earlier questions. Rules are evaluated in real time — fields appear and disappear as the user fills out the form.

Structure

Each field can have one conditionalLogic rule:
{
  "id": "details",
  "type": "textarea",
  "label": "Tell us more",
  "conditionalLogic": {
    "action": "show",
    "match": "all",
    "conditions": [
      {
        "fieldId": "satisfied",
        "operator": "equals",
        "value": "no"
      }
    ]
  }
}

Properties

PropertyTypeDescription
action"show" | "hide"Whether to show or hide the field when conditions are met
match"all" | "any"all = AND logic (every condition must pass), any = OR logic
conditionsCondition[]One or more conditions to evaluate

Condition Structure

{
  "fieldId": "plan_type",
  "operator": "equals",
  "value": "pro"
}
PropertyTypeDescription
fieldIdstringThe ID of the field whose value is checked
operatorConditionOperatorThe comparison to perform
valuestring | numberThe value to compare against (not required for is_empty / is_not_empty)

Operators

OperatorDescriptionWorks With
equalsExact matchAll types
not_equalsDoes not matchAll types
containsValue includes the stringtext, textarea, email
not_containsValue does not include the stringtext, textarea, email
greater_thanNumeric greater thannumber, rating, scale
less_thanNumeric less thannumber, rating, scale
is_emptyNo value enteredAll types
is_not_emptyAny value enteredAll types

Examples

Show a follow-up field

Show a text field only when the user selects “Other” from a radio:
{
  "id": "role_other",
  "type": "text",
  "label": "Please specify your role",
  "conditionalLogic": {
    "action": "show",
    "match": "all",
    "conditions": [
      { "fieldId": "role", "operator": "equals", "value": "other" }
    ]
  }
}

Hide a field based on NPS score

Hide a question unless the NPS score is low:
{
  "id": "what_went_wrong",
  "type": "textarea",
  "label": "What could we improve?",
  "conditionalLogic": {
    "action": "show",
    "match": "all",
    "conditions": [{ "fieldId": "nps", "operator": "less_than", "value": 7 }]
  }
}

Multiple conditions (AND)

Show a field only if the user is a Pro customer AND has submitted before:
{
  "conditionalLogic": {
    "action": "show",
    "match": "all",
    "conditions": [
      { "fieldId": "plan", "operator": "equals", "value": "pro" },
      { "fieldId": "returning", "operator": "equals", "value": "yes" }
    ]
  }
}

Multiple conditions (OR)

Show a field if the user selected either “email” or “phone”:
{
  "conditionalLogic": {
    "action": "show",
    "match": "any",
    "conditions": [
      { "fieldId": "contact_pref", "operator": "equals", "value": "email" },
      { "fieldId": "contact_pref", "operator": "equals", "value": "phone" }
    ]
  }
}

How It Works

  • Conditions reference fields by ID — the id property on a FormField
  • Fields referenced in conditions must appear before the conditional field in the fields array
  • Hidden fields are excluded from submission — their values are not sent
  • In conversational mode, hidden fields are skipped automatically in the navigation sequence
  • The statement and divider types are always excluded from submissions regardless of visibility