ChargeForms
Building Forms

Conditional Logic

Show, hide, or require fields based on a visitor's earlier answers, with nested AND/OR groups re-checked server-side at submission.

Ask AI about this:

How rules work

Conditional logic is built from rule groups. Each group has its own AND/OR logic across its rules, and groups are combined with OR between them — if any group matches, the condition is satisfied.

A rule compares one field's current value against an operator:

  • is / is not
  • contains / does not contain
  • is empty / is not empty

Setting it up

  1. Open a field's settings panel in the builder.
  2. Switch to the Conditional Logic tab.
  3. Choose the action — Show this field, or Hide it — when the rules below match.
  4. Add one or more rule groups, each referencing an earlier field's answer.

Example: ask for details only when they apply

Add a service choice field and a separate project details field. Configure the details field to Show when the service answer is the option that needs extra information. Match the option value used in your form.

A field selected in the ChargeForms builder with its settings panel visible
Start by selecting the field you want to configure. This screenshot shows the field settings panel; the rule setup is described in the steps above.

Test both paths on the published page: an answer that matches the rule and one that does not. Change your answer again to check that the field visibility updates.

Why it's safe to rely on

Visibility rules run twice: once in the browser (via frontend.js, for instant feedback as a visitor types) and again on the server when the form is submitted. The server-side check is the one that actually matters — a hidden required field can't be forced through by disabling JavaScript or editing the page's HTML, because SubmissionHandler::handle() re-evaluates every rule against the submitted values before deciding what's required.

Multi-step forms

Conditional logic works across multi-step forms too — a rule can reference an answer from any earlier step, not just fields on the same page.