Explain when input is not an allowed value
The field accepts one of a fixed set of values and the reader supplied something else, so the message has to say what the set is. G84 is the technique for writing it, and W3C counts it as sufficient for two rules on its own, error identification at Level A and error suggestion at Level AA, plus a third in combination with a live-region technique. In text is the phrase carrying the weight there. An asterisk on the label is not a description. Turning the label red is not a description. Words are. The message says why the input was not accepted and what would be accepted instead, which usually means naming the allowed values or pointing at the place they are listed.
How we find it in an audit
We enter values that are wrong in a specific way rather than simply blank, because a blank field belongs to a different technique. A country that is not a country, a currency the form does not take, a code from the wrong system. Then we read the message. Naming the problem is half of it, and naming the way out is the other half. Messages reading invalid input get written up, because they establish that something is wrong without establishing what.
How affected users experience it
A rejected entry with no explanation is a closed door with no handle on it. A screen-reader user cannot glance at a legend elsewhere on the page for a clue, so the message is all the information there is, and invalid country is not information. Readers with cognitive disabilities meet the identical wall. Both need the answer inside the sentence, and the difference between a form somebody finishes and one they abandon is usually a message that said what to type.
Passes vs. fails
Passes
We do not recognize UK. Country codes are two letters, like GB for the United Kingdom, and the full list is linked below.
Fails
Invalid country. The field is emptied. Nothing says whether the spelling, the format or the country itself was the problem.
How this gets tested
The W3C publishes test rules that define what a checker looks for here.
- Error message describes invalid form field valueA tool finds candidates, you decide
Other ways to satisfy this rule
13 guides on this site are filed under 3.3.1 Error Identification. W3C lists this one as sufficient for that rule on its own. Implement it correctly, in a way your readers' software actually supports, and the rule is met.
- ARIA18sufficientRaise blocking errors in an alert dialog
- ARIA19sufficientAnnounce form errors with role=alert
- ARIA21sufficientFlag invalid fields with aria-invalid
- G83sufficientTell users which required fields they missed
- G85sufficientExplain format errors and show the fix
- PDF5sufficientMark required fields in PDF forms
This guide is our interpretation of W3C technique G84: Providing a text description when the user provides information that is not in the list of allowed values. W3C publishes its techniques as guidance rather than as the standard, and says so on every one of them. The success criterion is what conformance is measured against, and a technique is one documented way to meet it.