Skip to content

FRM-002b Show a field's error when the person leaves the field or sends the form, and clear it as soon as the value is valid

Level
Rule
Verdict
Unanimous (2 of 2)
Area
Forms
Status
decided, version 1.0.4

Rule

Show a new error on a field only when the person leaves it after changing it or sends the form, never while they type; recheck an error that is already shown on every change and remove it as soon as the value is valid.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: Checked when the person moves on

Type 1135 in Postcode. Nothing happens until you move to City. Go back and add the 9: the error goes on that key press, and a screen reader hears that it is fixed.

Don't: Checked on every key press

The error appears on the first digit, before the person could possibly be done, and stays until the fifth.

Why

An error that appears halfway through a word scolds people for something they have not finished, and it hits slow typists and screen reader users hardest. Waiting until the person moves on lets them finish first and still hear about a mistake while the field is fresh in their mind. Sending the form is the safety net for every field they skipped. Clearing works the other way round: once the value is right, a lingering error is just noise, so it should go at once. Adding an error early hurts; removing one early helps. Where the error is shown is covered by FRM-002a.

Do

  • A person types "1135" in Postcode and moves on to City. Only then does Postcode show "Enter a five-digit postcode, for example 11359."
  • They go back and type the missing "9". The error disappears on that key press, without waiting for them to leave the field.
  • They press Send without ever visiting National ID number. Every field with a problem shows its error at once, National ID number included.
  • A check that only the server can make, such as whether a delivery address exists, runs when the person leaves the field or sends the form, and its result appears at the field. It never runs while they are still typing.
  • When an error appears as the person leaves a field, or a shown error clears while they type, keep focus where it is and announce the change, so screen reader users learn about it without being moved. Where focus goes when the form is sent with problems is the guideline FRM-011: to the first problem or to a summary of them.

Don't

  • Show "Invalid postcode" after the first digit, while the person is still typing.
  • Mark Customer number as missing just because the person tabbed past it on the way to Postcode. A field that is entered and left without a change waits until the form is sent.
  • Keep an error on a field after the person has fixed it, until they leave the field or send the form again.
  • Send the form and report only the first problem, leaving the rest to appear one round at a time.
  • Move focus to an error that appears when the person leaves a field. They have already moved on and should stay where they are.
  • Treat a live check on a new password as a reason to check email addresses, postcodes or national ID numbers while people type.

Exceptions

When a person creates a new value that must meet rules shown next to the field, such as a new password or a new user name, the field shows progress against those rules while they type. List the rules before they start and mark each one as met the moment it is, for example "At least one digit" turning to done after the first digit. This is progress, not an error: no red error state appears on a key press. A rule that is still unmet becomes an error only when the person leaves the field or sends the form. The exception covers new values with stated rules only, never ordinary fields.

When a short form keeps its send button unavailable until required input is in, as ACT-004 allows, sending can no longer reveal skipped fields. ACT-005 then applies: the text next to the button says what is still needed, and those untouched fields are not shown as errors.

Moving from a field to Cancel or the close control in a modal form holds back that field's check until focus moves on to something else, as FRM-003 describes.

A free-text field's count, and the words it shows at its length limit while people type, are not errors under this rule; they are the guidelines FRM-017b and FRM-017c. An error for text that is too long still waits until the person leaves the field or sends the form.

Verdict

Unanimous (2 of 2). Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work

Stances on FRM-002b
SourceRoleStancePage
WCAG 2.2LawSupports3.3.1 Error Identification
WCAG 2.2LawSupports4.1.3 Status Messages
Material DesignJudge No position
Apple Human Interface GuidelinesJudge SupportsText fields
Carbon Design SystemJudge SupportsForms
Text input: usage
GOV.UK Design SystemExpert witness Opposes, dissentingRecover from validation errors
Nielsen Norman GroupExpert witness Supports10 Design Guidelines for Reporting Errors in Forms, by Rachel Krause

Dissenting opinion: GOV.UK Design System.

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.4, : Refers to FRM-017b and FRM-017c for a free-text field's count and the words at its length limit, which are not errors.
  • Version 1.0.3, : Focus on a failed send now refers to FRM-011, for every form.
  • Version 1.0.2, : Examples in English.
  • Version 1.0.1, : Point to FRM-003 for moving from a field to Cancel in a modal form.
  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Forms: 15 rules and 12 guidelines · All rules