<errors of=…/>
Renders the auto-synthesized validity errors for a state cell, a compound, or a per-field expression. Companion to the universal-core validator vocabulary.
Syntax
<errors of=@cellExpr/>
<errors of=@compound.field all/>
<errors of=@compound/>
of=
takes a reactive expression pointing at a cell, a compound
field, or a compound as a whole. The all
attribute toggles full-array rendering (every error) vs.
first-error-only (default).
Worked example
A signup form. Three fields, three validators, one
<errors>
per field. Zero manual error state. The validity surface is
reactive, read-only, and updates as the user types.
<signup>
<name req length(>=2)> = <input type="text"/>
<email req> = <input type="email"/>
<agree req> = <input type="checkbox"/>
</>
<form onsubmit=submit()>
<label>Name <signup.name/></label>
<errors of=@signup.name/>
<label>Email <signup.email/></label>
<errors of=@signup.email/>
<label>Agree <signup.agree/></label>
<errors of=@signup.agree/>
<button type="submit" disabled=${!@signup.isValid}>Submit</button>
<errors of=@signup all/>
</form>
@signup auto-synthesizes
.isValid, .errors,
.touched, .submitted
at the rollup level; every field gets its own
.isValid, .errors,
.touched. Read-only. Per
SPEC §55.5 and §55.6.
Semantics
-
Errors are enum tags, not strings.
@signup.name.errors[0]is.Requiredor.LengthFailed(predicate)— consumers pattern-match on the tag. TheValidationErrorenum at SPEC §55.9 has one tag per predicate. -
Universal-core predicate vocabulary (14 predicates).
Same word at compile site and runtime:
req,is some,length(<rel-arg>),pattern,min,max,gt,lt,gte,lte,eq,neq,oneOf,notIn. Per SPEC §55.1. -
Three loci, same vocabulary. The same
predicates fire on state-cell decls (reactive form
validity), refinement-type expressions (compile-time +
runtime boundary), and
<schema>columns (additive to SQL-mirror DDL). Per Lock L4. -
4-level error message resolution chain.
(1) inline on decl
(
<name req:"Please enter your name">); (2) project-registered viaregisterMessagesfromscrml:data; (3) stdlib defaults (English); (4) match escape hatch (<match for=ValidationError>). Per SPEC §55.5. -
Cross-field validation via predicate args.
<confirm req eq(@signup.password)>— no separate cross-field vocabulary. The dependency is tracked at the predicate-arg level (Lock L14).
Errors this feature can fire
- E-ERRORS-001 — <errors of=expr/> missing of= attribute
- E-ERRORS-002 — <errors> on a cell with no validators
- E-SYNTHESIZED-WRITE — write to read-only @x.isValid / .errors / .touched
- E-DERIVED-WITH-VALIDATORS — validators on const-derived cells (forbidden)
- E-VALIDATOR-CIRCULAR-DEP — predicate-arg cycle across cells
Edge cases
-
The validity surface is read-only. Writing
to
@signup.isValid = truefires E-SYNTHESIZED-WRITE at compile time. To dismiss errors, fix the underlying cell value. To bypass validity entirely, the cell shouldn't have validators. -
Derived cells cannot carry validators.
const <fullName req> = …fires E-DERIVED-WITH-VALIDATORS. Use a refinement-type predicate at the type level instead — derived cells are an expression, not user input. -
The compound rollup is short-circuit-friendly.
@signup.isValidfalse-shortcircuits at the first invalid field. Useful for disabling submit buttons or gating server calls without walking every field manually. -
allattribute behaviour. Withoutall:<errors of=…/>renders the FIRST error only. Withall: renders the entire array. The default favours minimal UI noise;allis for forms where the user benefits from seeing every blocker at once.
Related features
- req — required validator. The most common validator in scrml code.
-
is some
— distinct from
req.is somechecks existence (""IS some);reqchecks meaningful value (""fails req). -
registerMessages
via
scrml:data— project-level message catalog for the 4-level resolution chain. - <schema> — third locus for the universal-core vocabulary. Schema columns can carry the same predicates.
- Learn: Validators — narrative walkthrough.
Availability
| Surface | Since | Notes |
|---|---|---|
| <errors of=…/> | S57 D2.8 (2026-05-04) Lock L13 | Spec §55.8; codegen A1c C11 shipped S73 |
| 14 universal-core predicates | S57 D2.8 Lock L4 | Spec §55.1; runtime catalog A1c C6 shipped S73 |
| Auto-synth validity surface | S57 D2.8 Locks L11 + L13 | Spec §55.5-§55.8; codegen A1c C8 shipped S73 |
| 4-level message resolution | S57 D2.8 Lock L12 | Spec §55.5 + §41.12 registerMessages |
| Cross-field validation | S57 D2.8 Lock L14 | Spec §55.11; predicate-arg dependency tracking §31.4 |
Specification
This page summarizes SPEC §55 (~26381-26869). The normative text lives at compiler/SPEC.md . When this page disagrees with SPEC.md, SPEC.md is authoritative.