# Form Validation

Form validation checks whether submitted or entered data meets defined requirements and helps users correct problems without losing valid work.

- Type: practice
- Domain: Experience & interface
- Level: Foundational
- Last reviewed: 2026-09-24
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/form-validation/>)

## What it means

Form validation applies syntactic, semantic, and business rules to input. Client-side validation can provide timely feedback, while server-side validation remains authoritative. Effective validation includes prevention, clear identification, specific correction guidance, preserved input, and accessible focus and announcements.

## Why it matters

Validation protects data quality and system rules, but its user experience determines whether errors become quick corrections or abandonment. Clear recovery reduces repeated effort, support demand, and accidental submission of unintended values.

## When to use it

Validate every meaningful constraint, prioritizing feedback when users can act on it. Validate on submission for cross-field or server-dependent rules, and use inline validation carefully after a field is complete. Do not reject harmless formatting that the system can normalize safely.

## How it works

1. Define rules from genuine data and business requirements, separating client hints from server authority.
2. Prevent invalid choices where feasible and explain format or constraints before entry.
3. Validate at a moment when the user has enough context to correct the value without premature interruption.
4. Associate each error with its field, preserve valid input, and provide a linked summary for longer forms.
5. After correction, clear stale errors and verify the submitted value on the server.

## A practical example

A registration form accepts spaces and hyphens in a phone number, normalizes them, and checks account uniqueness on the server. On submission, focus moves to an error summary linking to two invalid fields while all other entries remain intact.

## Where it breaks

Validation cannot guarantee truth, intent, or future validity. Overly strict rules exclude legitimate data, asynchronous checks can race with edits, and feedback shown on every keystroke can create noise and expose incomplete values as errors.

## Common mistakes

- Relying on client-side validation as a security boundary.
- Clearing the form after an unsuccessful submission.
- Showing error color without text, association, or correction guidance.
- Rejecting valid names, addresses, or formats because examples were mistaken for universal rules.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/form-validation/#visualization-form-validation>)

## Sources

1. [Validating Input](<https://www.w3.org/WAI/tutorials/forms/validation/>) — W3C Web Accessibility Initiative · Accessibility tutorial
2. [Error summary](<https://design-system.service.gov.uk/components/error-summary/>) — GOV.UK Design System · Institutional design system

## Related topics

- [Error Prevention](<https://wiki.soroush.uk/topic/error-prevention/>)
- [Error Recovery](<https://wiki.soroush.uk/topic/error-recovery/>)
- [Focus Management](<https://wiki.soroush.uk/topic/focus-management/>)
