Form data and validation

A form with slice captures its named controls under datadom.formData.<slice> as controls emit events and when the form submits. The same data is mirrored under the form slice and is the source of truth for rendering and validation.

The custom-validity expression can return a boolean or a message string. A false boolean prevents submission; a string makes the form or control invalid and supplies its validation message. Native and custom messages are available through datadom.validationState.

Template-owned capabilities

A reusable form input declares its behavior on the source template. In CEM-ML, the template header is {template @capability=form-control @type=text/cem-ml | ...}. The equivalent HTML is <template capability="form-control" type="text/cem-ml">. Use form-control for one string-valued input or textarea; sample 5 uses choice-select for its choice buttons.

The runtime reads this metadata before registering the custom element. An import using src="./controls.xhtml#account-input" inherits the selected template's capability, falling back to its immediate owning cem-element. An explicit capability on the importing declaration wins; an empty value suppresses inheritance. Preserve this metadata when copying a template: rendering an input alone does not give its DCE host submission, validation or reset behavior. See the capability loading contract.

See the browser APIs behind these examples in FormData and Constraint validation.

See also

Slice declarations and event bindings

DOM merge during live control updates

DCE attributes and derived values