When to validate a form field
People want to know a field is wrong before they move on, but an error that appears while they are still typing interrupts them.
The answer
Check on submit, and do not show an error until people have finished the field. As strong as the weakest rule behind it: moderate.
-
Check every field on submit, whatever ran before, and check again on the server.
Every source that covers timing validates on submit, and the browser's built-in check runs then. Convention only, so 3.
- Applies when
- Always.
- Based on
- Convention
- Principle
- Prevent errors
- StandardStandard: HTML Living Standard, constraint validation (form control infrastructure)WHATWG
- GuidanceGuidance: Help users to recover from validation errors (Validation pattern)GOV.UK Design System
- Guidance: Validation pattern (Cloudscape Design System)Amazon Web Services
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: Forms (React Aria)Adobe
- Guidance: Forms pattern and Form component usage/accessibility pages (Carbon)IBM
-
Don’t show an error before people finish a field: not on entering it, not on the first keystroke, and not for fields they haven’t reached.
One practitioner test with a published method, consistent practitioner guidance, and browser behavior that ignores length limits until the person edits. Atlassian and Apple describe earlier checks for some fields. No controlled study isolates it, so 3.
- Applies when
- The person has not finished the field yet.
- Based on
- Practitioner research
- Depends on
- State of the field
- Principle
- Keep people informed
- Common mistake
- Showing an error on the first keystroke or as the person enters a field. In the one test that included it, checking before and while typing gave the worst results (Luke Wroblewski). See rule 6.
- ExperimentsExperiment: Inline Validation in Web FormsLuke Wroblewski
- Experiment: Usable error message presentation in the World Wide Web: Do not show errors right awayBargas-Avila, 2007
- User researchUser research: Inline form validation (public article)Baymard Institute
- User research: A Complete Guide To Live Validation UXVitaly Friedman, 2022
- StandardStandard: HTML Living Standard, constraint validation (form control infrastructure)WHATWG
- GuidanceGuidance: Error-message guidelines for formsNielsen Norman Group
- Guidance: Validation pattern (Cloudscape Design System)Amazon Web Services
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
The other rules
In every case
-
When a field fails a check, say which field and what’s wrong, in words.
Required by WCAG 2.2 at level A or AA, so rated 5 whatever the research says. All three criteria were reopened and checked.
- Applies when
- Always.
- Based on
- Standard or law
- Principle
- Help people recover from errors
- StandardStandard: Understanding SC 3.3.1 Error Identification (Level A)W3C WAI
-
If focus doesn’t move to an error message, make sure screen readers announce it.
Required by WCAG 2.2 at level A or AA, so rated 5 whatever the research says. All three criteria were reopened and checked.
- Applies when
- An error is shown while focus stays where it was.
- Based on
- Standard or law
- Principle
- Work for everyone
- StandardStandard: Understanding SC 4.1.3 Status Messages (Level AA)W3C WAI
-
Don’t move focus, submit or open anything just because a value changed, unless you said you would.
Required by WCAG 2.2 at level A or AA, so rated 5 whatever the research says. All three criteria were reopened and checked.
- Applies when
- Always.
- Based on
- Standard or law
- Principle
- Keep people in control
- StandardStandard: Understanding SC 3.2.2 On Input (Level A)W3C WAI
-
If a field takes only one format, state it before people type, in text that stays visible.
One controlled experiment (n=166) found far fewer errors when the format rule was stated up front than when it was not; a second study applied the same guideline in a bundle that cut failed submits. Lab tasks with artificial rules, so 4, not 5.
- Applies when
- The system accepts only one format.
- Based on
- Research
- Depends on
- How strict the format is
- Principle
- Prevent errors
- ExperimentsExperiment: Enhancing online forms: use format specifications for fields with format restrictions to help respondentsBargas-Avila, 2011
- Experiment: Designing Usable Web Forms: Empirical Evaluation of Web Form Improvement GuidelinesSeckler, 2014
- StandardStandard: Understanding SC 3.3.2 Labels or InstructionsW3C WAI
While people type
-
For rules people can’t guess, such as a new password, show which are met as they type.
Practitioner guidance agrees, but USWDS is retiring its own live checklist after screen reader and magnifier users did not notice it. Rated 2.
- Applies when
- The field has several rules, or a check only the server can make.
- Based on
- Practitioner research
- Principle
- Keep people informed
- ExperimentExperiment: Inline Validation in Web FormsLuke Wroblewski
- User researchUser research: A Complete Guide To Live Validation UXVitaly Friedman, 2022
- GuidanceGuidance: Error-message guidelines for formsNielsen Norman Group
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: Text fields (Human Interface Guidelines)Apple, 2023
- Guidance: Validation component (requirement checklist)U.S. Web Design System
-
Confirm a value is OK only when people can’t tell themselves, such as a username being free. Not for simple fields.
Sources split. Baymard favors success marks; Wroblewski's participants were unsure what a check mark meant; Silver argues they give false reassurance. Rated 2.
- Applies when
- Always.
- Based on
- Practitioner research
- Principle
- Leave out what is not needed
- ExperimentExperiment: Inline Validation in Web FormsLuke Wroblewski
- User researchUser research: Inline form validation (public article)Baymard Institute
- GuidanceGuidance: Error-message guidelines for formsNielsen Norman Group
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: The problem with live validation and what to do insteadAdam Silver
- Guidance: Validation pattern (Cloudscape Design System)Amazon Web Services
-
Don’t block or drop characters as people type. Accept the input, then explain what’s wrong.
One company guideline plus GOV.UK's report that number inputs silently dropped letters. Guidewire's phone field restricts entry to digits. Rated 2.
- Applies when
- Always.
- Based on
- Convention
- Principle
- Keep people in control
- GuidanceGuidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
- Guidance: Why the GOV.UK Design System team changed the input type for numbersGOV.UK Design System team, 2020
When they leave a field
-
Don’t show errors yet, unless testing on your form shows that checking here helps.
Evidence points both ways. See open questions. Rated 1.
- Applies when
- The person is leaving the field for the first time and no error is shown yet.
- Based on
- Research
- Depends on
- State of the field
- Principle
- Keep people informed
- ExperimentsExperiment: Usable error message presentation in the World Wide Web: Do not show errors right awayBargas-Avila, 2007
- Experiment: Inline Validation in Web FormsLuke Wroblewski
- Experiment: Error Messages Timing and Graphical Presentation for Smartphones Arabic FormsAlsalamen, 2024
- User researchUser research: Comparing the Effectiveness of Alternative Approaches for Displaying Edit-Error Messages in Web FormsWilliam Mockovak, 2005
- User research: Inline form validation (public article)Baymard Institute
- GuidanceGuidance: Help users to recover from validation errors (Validation pattern)GOV.UK Design System
- Guidance: Error message componentNHS digital service manual
- Guidance: The problem with live validation and what to do insteadAdam Silver
- Guidance: Error-message guidelines for formsNielsen Norman Group
- Guidance: Forms pattern and Form component usage/accessibility pages (Carbon)IBM
- Guidance: Validation pattern (Cloudscape Design System)Amazon Web Services
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: Forms pattern (Atlassian Design System)Atlassian
Once a field shows an error
-
Recheck it as people edit, and clear the error as soon as it’s fixed.
Consistent across practitioner research and five design systems, with no dissent found. No controlled study, so 3.
- Applies when
- The field is showing an error.
- Based on
- Practitioner research
- Depends on
- State of the field
- Principle
- Keep people informed
- User researchUser research: Inline form validation (public article)Baymard Institute
- User research: A Complete Guide To Live Validation UXVitaly Friedman, 2022
- GuidanceGuidance: Validation pattern (Cloudscape Design System)Amazon Web Services
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: Forms pattern (Atlassian Design System)Atlassian
- Guidance: Forms pattern and Form component usage/accessibility pages (Carbon)IBM
- Guidance: Forms (React Aria)Adobe
When they submit
-
Move focus to the errors (a summary or the first wrong field), and keep everything people typed.
Convention across GOV.UK, Primer and Vercel, matching what browsers do natively. They differ on summary versus first field, which is left to Error summaries.
- Applies when
- A submit was rejected.
- Based on
- Convention
- Principle
- Help people recover from errors
- StandardStandard: Understanding SC 3.3.1 Error Identification (Level A)W3C WAI
- GuidanceGuidance: Help users to recover from validation errors (Validation pattern)GOV.UK Design System
- Guidance: Error message componentGOV.UK Design System
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
-
Don’t list every error in one dialog.
In a lab comparison, one dialog listing every error produced about three times the repeat errors of errors shown in the form after submit. The same evidence supports Error messages rule 4, rated 3.
- Applies when
- Always.
- Based on
- Research
- ExperimentExperiment: Usable error message presentation in the World Wide Web: Do not show errors right awayBargas-Avila, 2007
-
Don’t rely only on the browser’s own error messages.
Browser messages can vanish, show one error at a time and are often generic. The WCAG Understanding document and GOV.UK guidance agree.
- Applies when
- Always.
- Based on
- Practitioner research
- StandardStandard: Understanding SC 3.3.1 Error Identification (Level A)W3C WAI
- GuidanceGuidance: Help users to recover from validation errors (Validation pattern)GOV.UK Design System
-
Keep the submit button usable before the form is valid. Disable it only while a submit is in progress.
Four design systems say keep it usable; Carbon allows a disabled control on short forms and Siemens offers it as an option. Convention with dissent, so 2 here. Submit button state, rule 1, written after more systems were read, rates the same rule 3 and is the one to follow.
- Applies when
- Always.
- Based on
- Convention
- Principle
- Keep people informed
- Common mistake
- A submit control that cannot be used and does not say why. See rule 12.
- GuidanceGuidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: Validation pattern (Cloudscape Design System)Amazon Web Services
- Guidance: Forms pattern (Atlassian Design System)Atlassian
- Guidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
- Guidance: Forms pattern and Form component usage/accessibility pages (Carbon)IBM
- Guidance: Forms behavior (iX design system, alpha docs)Siemens
Accessibility
- WCAG 2.2 · 3.3.1 · AThe field in error is identified and the error described in text. Silent on timing.
- WCAG 2.2 · 4.1.3 · AAAn error that appears without taking focus must be exposed through a role or property so it is announced.
- WCAG 2.2 · 3.2.2 · AChanging a value must not cause a change of context (focus move, submit, new window) without prior notice.
- WCAG 2.2 · 3.3.2 · AInstructions may state a required format.
- WCAG 2.2 · 3.3.3Also likely to apply: 3.3.3 Error Suggestion (AA). It belongs to Error message content.Error message content
Open questions
- OpenFirst entry: validate when the person leaves a field, or only on submit? The only controlled study read in full found more repeat errors when errors appeared on leaving the field (bargas-avila-2007-error-timing, 2007, desktop, students). A practitioner test found the opposite against a submit-only control (wroblewski-2009-inline-validation, n=22). A usability study found no difference (). No study tests "show errors late, clear them early", which is what most design systems now do.
- OpenPhones: two abstracts report that feedback before submit worked best on Arabic smartphone forms (). Full text not read.
- OpenScreen reader users: no study found. Primer says to avoid live regions for field errors; Vercel says to announce them politely. WCAG requires only that they can be announced.
- OpenDoes a disabled submit control hurt? Design systems disagree and no study was found. To be settled in Submit button state.
Sources
- ExperimentsExperiment: Enhancing online forms: use format specifications for fields with format restrictions to help respondentsBargas-Avila, 2011
- Experiment: Designing Usable Web Forms: Empirical Evaluation of Web Form Improvement GuidelinesSeckler, 2014
- Experiment: Inline Validation in Web FormsLuke Wroblewski
- Experiment: Usable error message presentation in the World Wide Web: Do not show errors right awayBargas-Avila, 2007
- Experiment: Error Messages Timing and Graphical Presentation for Smartphones Arabic FormsAlsalamen, 2024
- User researchUser research: Inline form validation (public article)Baymard Institute
- User research: A Complete Guide To Live Validation UXVitaly Friedman, 2022
- User research: Comparing the Effectiveness of Alternative Approaches for Displaying Edit-Error Messages in Web FormsWilliam Mockovak, 2005
- StandardsStandard: Understanding SC 3.3.1 Error Identification (Level A)W3C WAI
- Standard: Understanding SC 4.1.3 Status Messages (Level AA)W3C WAI
- Standard: Understanding SC 3.2.2 On Input (Level A)W3C WAI
- Standard: Understanding SC 3.3.2 Labels or InstructionsW3C WAI
- Standard: HTML Living Standard, constraint validation (form control infrastructure)WHATWG
- GuidanceGuidance: Help users to recover from validation errors (Validation pattern)GOV.UK Design System
- Guidance: Validation pattern (Cloudscape Design System)Amazon Web Services
- Guidance: Forms pattern, Validation sections (Primer, GitHub)GitHub
- Guidance: Forms (React Aria)Adobe
- Guidance: Forms pattern and Form component usage/accessibility pages (Carbon)IBM
- Guidance: Error-message guidelines for formsNielsen Norman Group
- Guidance: Forms pattern (Atlassian Design System)Atlassian
- Guidance: Error message componentGOV.UK Design System
- Guidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
- Guidance: Error message componentNHS digital service manual
- Guidance: The problem with live validation and what to do insteadAdam Silver
- Guidance: Text fields (Human Interface Guidelines)Apple, 2023
- Guidance: Validation component (requirement checklist)U.S. Web Design System
- Guidance: Forms behavior (iX design system, alpha docs)Siemens
- Guidance: Why the GOV.UK Design System team changed the input type for numbersGOV.UK Design System team, 2020
Related
- Error message contentSay which field is wrong and how to fix it, right next to the field.Answer: strong.
- Error summariesAfter a failed submit, list every error at the top, each linking to its field, and keep the message at each field too.Answer: moderate.
- Preserving input after an errorNever make people type something twice. Keep what they entered through errors and back steps.Answer: weak.
- Submit button stateKeep submit usable so it shows what is missing, and stop a second submission while the first is processing.Answer: moderate.