Form Validation

This topic collects the decisions a form has to make about input before it is trusted. Blocking a submit until a field is correct, matching a value against a stated rule, wiring error text to the control it describes, announcing a problem without stealing focus, and keeping server and browser checks in agreement are the recurring tasks. Each example records whether validation runs on input, on blur, or on submit, and which browsers or assistive technology paths were verified. Use the task groups to move from a single field rule to an accessible error summary, then follow relationships into the fetch examples that send the accepted value and the markup examples that give the field its accessible name in the first place.

In scope: Include examples that decide whether input is acceptable, or that surface a validation result to the reader. Out of scope: Exclude submission transport concerns that belong to fetch, and exclude styling of inputs without any checking rule.

7 published examples across 3 primary task groups. Read the group heading to find the task you are solving, then pick the Example whose assumptions match your page.

Author accessible form markup

2 examples

Write native form markup whose labels, grouping, and error associations are announced correctly.

Create CSS design tokens

1 example

Express reusable colour, spacing, and focus values through custom properties and the cascade.

Validate form input

4 examples

Decide whether entered data is acceptable and report the result to the person filling the form.

Adjacent navigation