Skip to main content
Version: 2.4

Form Effects

A Form Effect has three parts: a trigger starts it, an optional condition decides whether it applies, and actions do the work. A watched value, widget event, or another effect can start it. Effects live in the form schema's root effects[] array and can change controls, run a server-side script, or invoke another effect.

Start with one visible result

When a user changes Country, the selected City is cleared. That prevents a city from the previous country remaining in the form. This example assumes the form already has country and city controls.

  1. In the Form Designer, open Effects with the lightning icon and select Add effect.
  2. Name the effect clear-city-after-country-change and keep Value change.
  3. Add $value.country to Listen.
  4. Add a Clear action for the literal field path city and choose Empty.
  5. In the preview, select a city and then change the country. City becomes blank.

The effect saved in the schema is:

{
"id": "clear-city-after-country-change",
"listen": ["$value.country"],
"do": [{"type": "clear", "field": "city", "mode": "empty"}]
}

Changing City alone does not run this effect. The initial Country value is also only a baseline; use runOnInitialization when an effect must run once as the form opens. See Triggers and conditions.

Read an effect

PartIn this exampleQuestion to ask
Triggerlisten: ["$value.country"]What starts the rule?
ConditionNo when propertyMust anything else be true?
Actionclear on cityWhat changes when it runs?

When to Use an Effect

Choose the simplest form feature that expresses the required behavior:

RequirementRecommended solution
Display a read-only value calculated from other fieldsA JEXL default expression on that field
Hide, disable, or make a widget read-onlyA dynamic widget property
Change, clear, or copy another form controlA Form Effect
React to a button, tab, step, attachment, or another widget eventA widget-event Form Effect
Execute a server-side script as part of a form workflowA script action in a Form Effect
Dispatch page-level UI or store behavior after an operationA Success / Error Action
Effect or computed value?

Use a computed default for a pure value derived into the same control. Use an effect when the form must change another control, clear user input, copy a value, or start an external operation.

Explore the workflow

Next pageWhat it explains
Triggers and conditionsValue changes, widget events, explicit calls, and when
ActionsSetting, copying, and dispatching values
Clearing and resettingThe three clear modes and array row behavior
Scripts and execution orderServer responses, waiting, cascades, and reusable effects
Paths and expressionsLiteral control paths, JEXL, context, and data sources
Arrays and nested formsRow-scoped effects and complete schemas
Form Logic EditorVisualize and edit the same effects
Diagnostics and troubleshootingValidation messages and runtime investigation
Form Effects ReferenceRoot schema and effect object contract

To inspect which effects actually ran for a field in a live form, use the Form Runtime Debugger.