Core Features

Conditional Logic

Show or hide fields based on other field values.

Fields can be conditionally shown or hidden based on the values of other fields. This lets you build dynamic forms that adapt in real time as the respondent fills them out.

Conditional visibility requires the FIELD_CONDITIONAL_VISIBILITY feature flag to be enabled in your config/filaforms.php.

Visibility Modes

Each field has a visibility mode that controls its default state and how conditions affect it.

ModeBehavior
ALWAYS_VISIBLEField is always shown (default)
SHOW_WHENField is hidden by default, shown when conditions are met
HIDE_WHENField is visible by default, hidden when conditions are met

Conditions

A condition references a target field by its field code, an operator, and an expected value. You can attach multiple conditions to a single field.

Each condition is defined by three properties:

PropertyDescription
field_codeThe code of the field to watch
operatorThe comparison operator to apply
valueThe expected value to compare against (not required for is_empty and is_not_empty)

Operators

FilaForms provides 8 comparison operators.

OperatorDescription
equalsExact match. Case-insensitive for strings.
not_equalsNot an exact match.
containsSubstring match for strings, element check for arrays.
not_containsOpposite of contains.
greater_thanNumeric comparison. Returns false for non-numeric values.
less_thanNumeric comparison. Returns false for non-numeric values.
is_emptyField has no value (null, empty string, or empty array). No comparison value needed.
is_not_emptyField has a value. No comparison value needed.

Operator Compatibility by Field Type

Not all operators work with all field types. The table below shows which operators are available for each data type.

Field Data TypeCompatible Operators
STRING, TEXTequals, not_equals, contains, not_contains, is_empty, is_not_empty
NUMERIC, FLOAT, DATE, DATE_TIMEequals, not_equals, greater_than, less_than, is_empty, is_not_empty
BOOLEANequals, is_empty, is_not_empty
SINGLE_CHOICEequals, not_equals, is_empty, is_not_empty
MULTI_CHOICEcontains, not_contains, is_empty, is_not_empty

Logic Modes

When a field has multiple conditions, a logic mode determines how they combine.

Logic ModeBehavior
ALL (AND)All conditions must be met for the result to be true
ANY (OR)Any single condition being met is enough for the result to be true

Cascading Visibility

Visibility cascades through field dependencies. If Field B depends on Field A, and Field A is hidden because its own conditions are not met, then Field B is also hidden automatically -- regardless of whether Field B's own conditions are satisfied.

The system builds a dependency graph and recursively evaluates parent fields before evaluating a child field.

Always Save Option

By default, hidden fields are excluded from submission data. When alwaysSave is enabled on a field's visibility configuration, the field's value is saved to the submission even when the field is not visible.

This is useful when you need to preserve data that was entered before a field became hidden.

How It Works Client-Side

Conditional visibility runs entirely in the browser using Alpine.js. The AlpineVisibilityGenerator service translates each field's visibility rules into JavaScript expressions that are passed to Filament's visibleJs method. No page reload is needed -- fields appear and disappear instantly as the respondent interacts with the form.

The same evaluation logic runs on the backend during submission processing, so visibility is always consistent between what the user sees and what gets saved.

Example

A common use case: show a "Company Name" text field only when a "Type" select field equals "business".

In the form builder:

  1. Add a Select field with code type and options "Personal" and "Business"
  2. Add a Text field with code company_name
  3. On the company_name field, open the visibility settings
  4. Set the visibility mode to Show when conditions are met
  5. Add a condition: field type / operator equals / value Business

The company name field will remain hidden until the respondent selects "Business" from the type dropdown.

Copyright © 2026