<change> Event Handler Conversion
Input <change> handlers convert to expressions.conditions + expressions.eval ternaries.
When to load
Load when the classic XML has a <change> element inside an <input>.
Supported conversions
<condition value="x">equality matches → named condition + eval ternary.<condition match="...">SPL boolean expressions → JSONata condition + eval ternary.- Nested
<condition>elements → flattened withand. - Catch-all
<condition>(novalue/match) → final else in the ternary chain. <set>and<unset>inside a condition → eval entry withnullfor the unset branch.
Unsupported — warn or ask
- A
<change>handler that sets tokens with logic that can’t be expressed as condition + eval ternaries (SPL function calls, multi-step eval chains) — list in skipped features.
If the only effect is setting a token another input’s search depends on, use
isCascadingInputinstead — no explicit<change>conversion needed. Seeform-inputs.md.
Conversion rules
- Each
<condition value="x">→ named condition$inputToken$ = 'x'. Each<set>→ eval ternary. <unset>→nullin the else branch.- Multiple
<set>in one condition → one eval entry per token, same condition key. - Condition key naming:
<inputToken>_is_<value>(e.g.view_is_steps). - For
<condition match="...">, translate the SPL boolean to JSONata:$value$ == "x"→$<inputToken>$ = 'x'$value$ != "x"→$<inputToken>$ != 'x'$value$ == ""→$<inputToken>$ = ''"→',&→&,<→<,>→>
- Nested conditions → flatten with
and: each ancestor condition’s predicate isand-ed with its children’s predicates. - Catch-all
<condition>(novalue/match) is always true — tokens it sets become the final else in the ternary chain (append: $inputToken$).
Examples
<condition value="x"> — equality match
<input type="link" token="view">
<change>
<condition value="steps">
<set token="showSteps">true</set>
<unset token="showLogs"/>
</condition>
<condition value="logs">
<set token="showLogs">true</set>
<unset token="showSteps"/>
</condition>
</change>
</input>
→
"conditions": {
"view_is_steps": { "name": "view_is_steps", "value": "$view$ = 'steps'" },
"view_is_logs": { "name": "view_is_logs", "value": "$view$ = 'logs'" }
},
"eval": {
"showSteps": { "name": "showSteps", "value": "$condition:view_is_steps$ ? 'true' : null" },
"showLogs": { "name": "showLogs", "value": "$condition:view_is_logs$ ? 'true' : null" }
}<condition match="..."> — expression match
<condition match="$value$ == "true"">
<set token="show_panel">true</set>
</condition>
→
"html1_is_true": { "name": "html1_is_true", "value": "$html_summary1$ = 'true'" }
"show_panel": { "name": "show_panel", "value": "$condition:html1_is_true$ ? 'true' : null" }Nested conditions — flatten with and
<condition value="production">
<condition field="status" value="critical">
<set token="action">immediate</set>
</condition>
</condition>
→
"is_prod_critical": { "name": "is_prod_critical", "value": "$env$ = 'production' and $status$ = 'critical'" }
"action": { "name": "action", "value": "$condition:is_prod_critical$ ? 'immediate' : null" }Catch-all <condition> (no value/match)
<condition><set token="filter">$value$</set></condition>
→ append : $inputToken$ as the final else.
Report notes
- List every
<change>handler that could not be expressed as condition + eval ternaries (SPL functions, multi-step eval chains) as a skipped feature. - Note where a
<change>handler was replaced byisCascadingInputrather than an explicit conversion.