FormWork FormWork

Conditional Logic

Show or hide fields dynamically based on user input.

Conditional logic lets you create dynamic forms that adapt based on user input. Show or hide fields, pages, or sections based on the values of other fields.

How Conditional Logic Works

Each field can have conditional logic that determines when it’s visible:

  1. Define conditions based on other field values
  2. When conditions are met, the field is shown (or hidden)
  3. Conditions are evaluated in real-time as users fill out the form

Setting Up Conditional Logic

Add Conditional Logic to a Field

  1. Select a field in the builder
  2. Click the Logic tab in the field panel
  3. Click Add Condition
  4. Configure the condition
  5. Save

Condition Structure

Each condition has:

  • Field: Which field to check
  • Operator: How to compare
  • Value: What to compare against

Example:

IF "country" EQUALS "United States" THEN show "state"

Condition Actions

Show When

The field is visible when conditions are met.

Use for fields that only apply in certain situations:

  • State/province when country is selected
  • Spouse information when married
  • Additional options when feature is enabled

Hide When

The field is hidden when conditions are met.

Use for fields that should be hidden in certain situations:

  • Skip questions based on previous answers
  • Hide irrelevant options

Building Conditions

Simple Conditions

Single condition:

Show "phone" WHEN "contact_preference" = "call"

Multiple Conditions

Combine with AND/OR logic:

Show "shipping_address" WHEN:
  "delivery_method" = "ship"
  AND "country" = "United States"

Condition Groups

Group conditions for complex logic:

Show "discount_field" WHEN:
  (
    "customer_type" = "premium"
    OR "order_total" > 1000
  )
  AND "promo_enabled" = true

Available Operators

Comparison Operators

OperatorDescriptionExample
eq (equals)Exact matchname = “John”
neq (not equals)Not exact matchstatus ≠ “completed”
gt (greater than)Numeric comparisonage > 18
gte (greater or equal)Numeric comparisonscore >= 80
lt (less than)Numeric comparisonquantity < 10
lte (less or equal)Numeric comparisonprice <= 100

Text Operators

OperatorDescriptionExample
containsContains substringemail contains “@gmail”
not_containsDoesn’t containname not contains “test”
starts_withBegins withphone starts with “+1”
ends_withEnds withemail ends with “.edu”
matches_patternRegex matchcode matches ”^[A-Z]{3}$“

Value Operators

OperatorDescriptionExample
is_emptyHas no valuenotes is empty
is_not_emptyHas a valueemail is not empty
is_trueBoolean trueagree is true
is_falseBoolean falsesubscribe is false

Length Operators

OperatorDescriptionExample
length_eqExact lengthzip length = 5
length_neqNot exact lengthcode length ≠ 3
length_gtLonger thanmessage length > 100
length_ltShorter thanname length < 50

Field Compatibility

Which Fields Can Be Referenced

You can reference:

  • Fields on the same page
  • Fields on previous pages
  • Non-repeatable fields from anywhere
  • Sibling fields within the same repeatable group

Within Repeatable Groups

Inside a repeatable group:

  • Reference sibling fields in the same instance
  • Reference the current instance’s values
  • Reference global (non-repeating) fields

Visibility Calculation

When Visibility Updates

  • Immediately when referenced field values change
  • On page load/navigation
  • After workflow updates

Hidden Field Behavior

When a field is hidden:

  • It’s not visible to the user
  • Its value is preserved (unless cleared)
  • It’s not validated
  • It’s not required

Clearing Hidden Values

Optionally clear values when hidden:

  1. Enable “Clear when hidden” option
  2. Value is reset when conditions hide the field
  3. Useful for preventing stale data

Examples

Country-Based Address

Show "state" WHEN "country" = "United States"
Show "province" WHEN "country" = "Canada"
Show "county" WHEN "country" = "United Kingdom"

Employment Details

Show "employer_name" WHEN "employment_status" = "employed"
Show "school_name" WHEN "employment_status" = "student"
Show "retirement_date" WHEN "employment_status" = "retired"

Progressive Disclosure

Show "advanced_options" WHEN "show_advanced" = true

Within advanced_options:
  Show "custom_domain" WHEN "use_custom_domain" = true
  Show "api_key" WHEN "enable_api" = true

Best Practices

Keep It Simple

  • Don’t over-complicate logic
  • Use clear field names
  • Document complex conditions

Test Thoroughly

  • Test all condition combinations
  • Check edge cases
  • Verify on different devices

Consider User Experience

  • Don’t hide too much initially
  • Provide context for why fields appear
  • Make logical groupings

Performance

  • Complex conditions can slow forms
  • Limit nested condition depth
  • Consider breaking into pages