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.
- In the Form Designer, open Effects with the lightning icon and select Add effect.
- Name the effect
clear-city-after-country-changeand keep Value change. - Add
$value.countryto Listen. - Add a Clear action for the literal field path
cityand choose Empty. - 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
| Part | In this example | Question to ask |
|---|---|---|
| Trigger | listen: ["$value.country"] | What starts the rule? |
| Condition | No when property | Must anything else be true? |
| Action | clear on city | What changes when it runs? |
When to Use an Effect
Choose the simplest form feature that expresses the required behavior:
| Requirement | Recommended solution |
|---|---|
| Display a read-only value calculated from other fields | A JEXL default expression on that field |
| Hide, disable, or make a widget read-only | A dynamic widget property |
| Change, clear, or copy another form control | A Form Effect |
| React to a button, tab, step, attachment, or another widget event | A widget-event Form Effect |
| Execute a server-side script as part of a form workflow | A script action in a Form Effect |
| Dispatch page-level UI or store behavior after an operation | A Success / Error Action |
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 page | What it explains |
|---|---|
| Triggers and conditions | Value changes, widget events, explicit calls, and when |
| Actions | Setting, copying, and dispatching values |
| Clearing and resetting | The three clear modes and array row behavior |
| Scripts and execution order | Server responses, waiting, cascades, and reusable effects |
| Paths and expressions | Literal control paths, JEXL, context, and data sources |
| Arrays and nested forms | Row-scoped effects and complete schemas |
| Form Logic Editor | Visualize and edit the same effects |
| Diagnostics and troubleshooting | Validation messages and runtime investigation |
| Form Effects Reference | Root schema and effect object contract |
To inspect which effects actually ran for a field in a live form, use the Form Runtime Debugger.