Accessible Form Validation and Error Messages

Error repair rule: Validate as permissively as the business rule allows, identify each error in text, connect the message to its field, preserve correct answers, and guide focus to a summary when several problems block submission.

Published by Web-Forms.net on . Last editorial review: . Standards and operational claims are linked on this page.

Before and after error wording

Consider a date field that says Invalid input. The message gives no clue whether the value is impossible, outside an allowed period, or merely formatted differently. A better message names the rule: Choose a date from 12 November through 20 December 2026. If typed dates are accepted, the hint can add an example without rejecting equivalent valid formats.

For a choice group, This field is required is less useful than Choose one delivery method. Review every message beside the real label and rejected value. If the same generic sentence appears everywhere, the validation layer is exposing its implementation rather than helping the person recover.

Retest the corrected experience with the full online form accessibility checklist.

Separate a true business rule from a formatting preference

Validation should protect a real requirement, not force everyone to imitate one example. A phone number can contain spaces, plus signs, parentheses, and different lengths. Names may contain punctuation or a single word. Postal codes are not universally numeric. Normalize harmless differences when possible and explain constraints before submission when the user can act on them.

Client-side checks can provide quick feedback, but the same rules must be enforced on the server because browser code can be bypassed. Keep both layers consistent so an answer accepted in the interface is not rejected later with a different rule.

If the system changes a value, show the normalized result before a consequential transaction rather than silently altering meaning.

Maintain a validation inventory beside the form specification. For each rule, record the business reason, accepted examples, rejected examples, normalization step, client behavior, server behavior, and owner. Include empty, boundary, international, pasted, and unusually long valid values.

This inventory makes contradictions visible, such as a browser accepting a phone number that the server rejects, and gives reviewers a concrete basis for removing rules that protect only a formatting preference.

  • Write the reason for every rejection rule
  • Accept equivalent valid formats
  • Keep browser and server rules aligned
  • Do not use validation as a substitute for output encoding or parameterized queries

Write a message that names the problem and the repair

Invalid is not a repair instruction. Use a field-specific message such as Enter an email address in the form [email protected], or Choose at least one delivery method. Keep the original label visible and associate the message with the control so assistive technology can discover it.

Color may reinforce the state but cannot be the only signal.

Avoid announcing an error on every keystroke. A person may still be composing a valid value, and repeated live messages create noise. Validate on a meaningful event such as leaving the field or submitting, then remove the error state as soon as the value satisfies the rule.

When a suggestion could affect legal, financial, or other consequential data, let the user review the correction instead of changing it automatically.

Use a repeatable message structure: field name, problem, and repair. Date of visit: choose a date on or after 12 November tells the person more than Invalid date. Where a value has several acceptable formats, describe the constraint without presenting one example as the only valid answer.

Keep technical identifiers, regular-expression language, and database terminology out of the message. The person needs the rule they can act on, while diagnostic details belong in restricted logs.

Error-message rewrite sheet

Capture the rejected value, the actual rule, the message shown, and the exact repair a respondent can make without guessing.

  • Field and rejected example
  • Actual business rule
  • Formats that should also be accepted
  • Plain-language problem
  • Specific repair instruction
  • Keyboard and screen reader correction result

Provide a reliable route through several errors

When submission reveals multiple problems, add an error summary before the form. Give it a clear heading, list the messages as links to their controls, and move focus to the summary when that behavior is tested and predictable. Keep inline messages beside each field because the summary alone loses context after navigation.

Preserve all valid values and the user's position whenever possible.

Test the correction loop, not only the initial error. Follow a summary link, change the value, submit again, and confirm the resolved item disappears without stale announcements. Check conditional fields that become hidden, because their old errors should not keep blocking an unrelated path.

Log aggregate error counts without storing unnecessary values so recurring design problems can be fixed safely.

Include server and connection failures in the correction path. If the final request fails after local validation, preserve the entered values, distinguish a temporary service problem from a field error, and avoid telling the person to correct valid data. Make repeated submission safe so a retry does not create duplicate orders or cases.

Review telemetry by rule and form version; a sudden concentration of one error is evidence to inspect the question, accepted formats, or release, not proof that respondents are careless.

Validation and error guidance

Error-message edge cases

Where should a form error appear?

Place a specific message beside the affected field and connect it in markup. When several fields fail, add a summary that links to each problem.

Should a form remove valid answers after an error?

No. Preserve answers that already passed validation so the person can focus on the actual problem. Explain the repair without blame or vague wording.

Rewrite one failure before changing every message

Start with the error that blocks the most people, test its repair path, and use the evidence to improve the remaining rules.

Use the builder to test a correction path in a working form before publishing the validation rules.