Wit Form
Validation

Field Rules

Errors show after you leave a field, or for every field when you submit. Validation itself runs on every change, so an error clears as soon as you fix it.

3–20 letters, numbers or underscores

Optional

What this shows

Each field takes a validate(value) function that returns an error message, or null when the value is valid. See Validation.

  • Validation runs on every change. The error shows once the field is touched.
  • On submit every field is validated and touched. If any fail, onError(fieldErrors) is called instead of onSubmit.
  • Validators are defined outside the component, because validate is read once, when the field mounts.

The TextField, NumberField, SelectField and CheckboxField components come from the shared example components.

On this page