Skip to documentation content

Form Field Conditions

Form Field Conditions

Show/hide conditions on form fields, including the shared {{ condition }} shape and each typed condition object.

Each form field has exactly one condition. That value is polymorphic: Liquid exposes it as {{ condition }}, but at runtime it is one of the typed condition objects on this page. Use object_type or type to tell which implementing type you have.

To combine tests, nest them in an and_condition or or_condition. Those groups hold a list of condition objects, and groups may nest.

{{ condition }} documents only the shared properties. Typed objects add the rest (field_id, value, invert, and so on). These are form-field show/hide conditions, not Liquid {% if %} operators — those stay on Conditions Overview.

{{ condition }}

{{ condition }} is the shared shape for a form field's show/hide rule. It is not a separate runtime type: each field has exactly one condition, and that value is one of the typed condition objects (eq_condition, and_condition, and the rest). Use object_type or type to tell which implementing type you have.

Properties
Properties of {{ condition }} objects
Name Type Description
is_valid boolean Will be true when the condition exists and is valid
object_type string The object_type of the implementing condition (for example eq_condition or and_condition)
type string The type of condition. Each type corresponds to a different condition object which has its own additional properties
output string {JSON object}

Typed condition objects add further properties that are not listed here (for example field_id, value, invert, or a nested conditions list). See each type on this page. Multiple tests are grouped with and_condition or or_condition; those groups may nest.

{{ and_condition }}

A grouped form-field condition that is true when every nested condition is true.

Properties
Properties of {{ and_condition }} objects
Name Type Description
is_valid boolean Will be true when this group contains one or more nested conditions
object_type string Will always be "and_condition"
type string Will always be "and"
invert boolean When true, the grouped result is reversed
conditions list The list of nested condition objects that must all be true. Each item is one of the typed {{ condition }} objects. Groups may nest and_condition and or_condition
output string {JSON object}

{{ contains_condition }}

A form-field condition that is true when a list field contains a given value.

Properties
Properties of {{ contains_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id and value are set
object_type string Will always be "contains_condition"
type string Will always be "contains"
invert boolean When true, the condition is true when the field does not contain the value
field_id string The field_id of the list field to test
value string The value to look for in the target field
output string {JSON object}

{{ eq_condition }}

A form-field condition that is true when another field's value equals a given value.

Properties
Properties of {{ eq_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id and value are set
object_type string Will always be "eq_condition"
type string Will always be "eq"
invert boolean When true, the condition is true when the values are not equal
field_id string The field_id of the field to compare
value string The value that the target field must equal
output string {JSON object}

{{ exists_condition }}

A form-field condition that is true when another field has a value.

Properties
Properties of {{ exists_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id is set
object_type string Will always be "exists_condition"
type string Will always be "exists"
invert boolean When true, the condition is true when the target field does not have a value
field_id string The field_id of the field whose presence is tested
output string {JSON object}

{{ gt_condition }}

A form-field condition that is true when another field's value is greater than a given value.

Properties
Properties of {{ gt_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id and value are set
object_type string Will always be "gt_condition"
type string Will always be "gt"
field_id string The field_id of the field to compare
value string The value that the target field must be greater than
output string {JSON object}

{{ gte_condition }}

A form-field condition that is true when another field's value is greater than or equal to a given value.

Properties
Properties of {{ gte_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id and value are set
object_type string Will always be "gte_condition"
type string Will always be "gte"
field_id string The field_id of the field to compare
value string The value that the target field must be greater than or equal to
output string {JSON object}

{{ in_condition }}

A form-field condition that is true when another field's value is one of a delimited list of values.

Properties
Properties of {{ in_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id, value, and delimiter are set
object_type string Will always be "in_condition"
type string Will always be "in"
invert boolean When true, the condition is true when the field's value is not in the list
field_id string The field_id of the field to compare
value string The delimited list of values to match against
delimiter string The string that separates values in the value list
values list The parsed list of values to match against
output string {JSON object}

{{ lt_condition }}

A form-field condition that is true when another field's value is less than a given value.

Properties
Properties of {{ lt_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id and value are set
object_type string Will always be "lt_condition"
type string Will always be "lt"
field_id string The field_id of the field to compare
value string The value that the target field must be less than
output string {JSON object}

{{ lte_condition }}

A form-field condition that is true when another field's value is less than or equal to a given value.

Properties
Properties of {{ lte_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id and value are set
object_type string Will always be "lte_condition"
type string Will always be "lte"
field_id string The field_id of the field to compare
value string The value that the target field must be less than or equal to
output string {JSON object}

{{ maxitems_condition }}

A form-field condition that is true when a list field has at most a given number of selected items.

Properties
Properties of {{ maxitems_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id is set and value is greater than 0
object_type string Will always be "maxitems_condition"
type string Will always be "maxitems"
field_id string The field_id of the list field to test
value integer The maximum number of selected items
output string {JSON object}

{{ mimic_condition }}

A shortcut that reuses another field's show/hide condition so you do not have to redefine the same rule on every field.

Properties
Properties of {{ mimic_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id is set
object_type string Will always be "mimic_condition"
type string Will always be "mimic"
invert boolean When true, the mimicked result is reversed
field_id string The field_id of the field whose condition should be reused
output string {JSON object}

mimic_condition lets you define a condition on a single field and apply that same rule to other fields without rewriting it. Liquid does not currently link to the referenced field; the template developer must look up that field and apply the result themselves.

{{ minitems_condition }}

A form-field condition that is true when a list field has at least a given number of selected items.

Properties
Properties of {{ minitems_condition }} objects
Name Type Description
is_valid boolean Will be true when field_id is set and value is greater than 0
object_type string Will always be "minitems_condition"
type string Will always be "minitems"
field_id string The field_id of the list field to test
value integer The minimum number of selected items
output string {JSON object}

{{ or_condition }}

A grouped form-field condition that is true when any nested condition is true.

Properties
Properties of {{ or_condition }} objects
Name Type Description
is_valid boolean Will be true when this group contains one or more nested conditions
object_type string Will always be "or_condition"
type string Will always be "or"
invert boolean When true, the grouped result is reversed
conditions list The list of nested condition objects. The group passes when any item is true. Each item is one of the typed {{ condition }} objects. Groups may nest and_condition and or_condition
output string {JSON object}