{validate}

Description

Runs the slice field-validation rules against the current item and returns the result as JSON. When every field is valid the result is an empty array, written []. Otherwise it is a JSON object keyed by field id, where each value is a pair of error code and human-readable message; the message is localized to the install language. The check covers all fields of the slice, not only the ones shown on the edit form. This command takes no parameters and reads the item it is rendered on, so it belongs in an item or form context - for example a confirmation view shown after a save. Rendered outside any item it returns an empty string. It only reads; it never changes or stores anything.

Examples

test{validate}
Expected[]
Actual[]
With no validation problems the JSON result is the empty array []. A typical use is a confirmation view after a save: an empty array means the saved item passed every field rule.
test[{item:5726c2c6b035d7aab450d1794e9e90d7:{validate}}]
Expected[[]]
Actual[[]]
validate has no id parameter; it always reads the current item. To validate a different item, switch the context with item:<id>:<code> and call validate inside. Here the stable fixture item is fully valid, so the report is the empty array [].
test[{validate}]
Expected[[]]
Actual[[]]
Rendered on an item whose fields are all valid, validate returns an empty array. The square brackets in the example are literal text around the command, so the empty result shows as two nested brackets.
virtual{validate}
Expected({"text............":[410,"Not filled (text............)"]} - one entry per failing field; 410 is the required-but-empty code)
Actual[]
When a field fails its rule the result is a JSON object keyed by field id; each value is [error code, message]. Code 410 is the not-filled error for a required field. The message text is localized to the install language, so the exact wording varies. This row is illustrative: it runs on a valid item (so the live result is []), and the expected below shows a representative invalid report.