Conditional Logic

Show or hide form elements based on customer input

Simply Forms team

Last Update il y a 6 jours

Conditional Logic lets you dynamically show or hide form elements based on a customer's input. By displaying only relevant fields, you can create cleaner, shorter, and more user-friendly forms.


Conditional Logic can be applied to almost every form element in Simply Forms, including all input fields, static fields like header, Paragraph, Label, Image, and container elements such as Fieldset, Two Column Row, Three Column Row, and other multi-column row layouts.

How Conditional Logic Works  

Each conditional rule consists of three parts:
  • Field – The form field whose value will be evaluated.
  • Operator – The comparison method.
  • Value – The value to compare against.
When the specified condition is met, Simply Forms will either:
  • Show the current element, or
  • Hide the current element,
depending on the selected action. For example:
FieldOperatorValueResult
Contact Methodequal toemailShow Email Address field
Rating>=4Show "Would you like to leave a review?"
Purchase TypecontainswholesaleShow Company Information section

 Supported Field Types  

The left side of a rule (the field being evaluated) can currently be one of the following field types:
Field TypeDescription
DropdownSingle option selection
CheckboxesMultiple option selection
Radio ButtonsSingle option selection
RatingNumeric rating
RangeNumeric slider

Supported Operators  

The available operators depend on the type of value being evaluated.

String Operator

For text-based values (such as Dropdown, Radio Buttons, or Checkbox option values), Simply Forms supports the following operators. All text comparisons are case-insensitive.
OperatorDescription
containsField value contains the specified text
not containField value does not contain the specified text
starts withField value begins with the specified text
ends withField value ends with the specified text
equal toExact match
not equal toValues are different

 Example (Checkboxes Field) 

Suppose a Checkbox field returns: 
Each selected value is evaluated individually. The rule returns true if any selected value satisfies the condition.
RuleResultReason
Contains "Email"TrueOne selected value is "Email".
Contains "Person"True"In-person" contains "Person" (case-insensitive).
Starts With "Ph"True"Phone" starts with "Ph".
Ends With "son"True"In-person" ends with "son".
Equal To "Email"TrueOne selected value exactly matches "Email".
Not Equal To "SMS"TrueAt least one selected value ("Phone", "Email", or "In-person") is not "SMS".
Contains "Fax"FalseNone of the selected values contains "Fax".

Number Operators  

For numeric values (such as Rating and Range), the following operators are available:
OperatorDescription
Equal To (=)Values are equal
Not Equal To (!=)Values are different
Greater Than (>)Larger than
Greater Than or Equal To (>=)Larger than or equal to
Less Than (<)Smaller than
Less Than or Equal To (<=)Smaller than or equal to

Example

RuleResults (Rating = 4)
Rating >= 4True
Rating > 4False
Rating < 5True

Combining Multiple Rules  

A condition can contain multiple rules. You can combine them using either AND or OR.

AND

All rules must be true. 

Example: The condition is satisfied only if both of the following rules are true.

OR

Any rule can be true.
Example: The condition is satisfied if either rule is true.

Using Conditional Logic with Container Elements 

One of the most powerful features of Simply Forms is that Conditional Logic can also be applied to container elements, including:
  • Fieldset
  • Two Column Row
  • Three Column Row
  • Other container elements
When a container is shown or hidden, all elements inside the container are automatically shown or hidden as well.This makes it easy to create dynamic sections of a form without configuring conditional logic for every individual field.


For example, you can place several company-related fields inside a Fieldset:
  • Company Name
  • Tax ID
  • Business Address
  • Contact Person
Then configure a single condition:
If the condition is not met, the entire section remains hidden.
This approach keeps your form easier to maintain and avoids repeating the same condition on multiple elements.

Requirement for Display Labels  

All input elements that participate in form submission must have a unique Display Label across the entire form, regardless of whether they are configured to Show or Hide.

This requirement does not apply to static elements such as Fieldset, since they do not collect user input or generate submission data.

Simply Forms uses the first non-empty line of an input element's Display Label as the key when storing submitted data. To ensure each submitted value can be uniquely identified, no two input elements can have the same Display Label.
Important: If this requirement is not met, the form cannot be saved until the duplicate or missing Display Labels are corrected.

Best Practices

  • Use meaningful and unique Display Labels for all input elements.
  • Group related fields inside a Fieldset or other container so a single condition can control the entire section.
  • Keep conditions as simple as possible to make forms easier to maintain.
  • Use AND only when every requirement must be met, and OR when any one condition should trigger the action.
  • Always test your form in both Preview mode and on your storefront to ensure Conditional Logic works as expected.


  •  

    Was this article helpful?

    0 out of 0 liked this article