If an input error is automatically detected and suggestions for correction are known, then the suggestions are provided to the user, unless it would jeopardize the security or purpose of the content. (Level AA)
While 3.3.1 Error Identification specifically want users to be notified the occurrence of the error message, 3.3.3 Error suggestion want the content authors to provide the suggestions to correct them. In many cases the error message only says that the error has occurred but will not provide the ways to correct them. Eg: When a month input field is entered with wrong data, the error message can be “Please correct the month text field”. This will be an appropriate error suggestion if the message says “Please provide the month within the range 01 to 12 in two digit values”.
In a form, information that is not accepted include information that is required but omitted by the user and information that is provided by the user but that falls outside the required data format or allowed values.
If the user omits required fields ensure that the error message clearly describes that form cannot be submitted without filling them. If the form contains more than one required field, mark an error statement such as “Field name cannot be left blank”. On the other hand avoiding the user to omit such fields should be the first priority for content authors. Check Mandatory fields and accessibility to understand how to provide accessible mechanisms to inform the users about the required fields.
If the user fills data that is not accepted by the form, the content author may provide the description of the error, or the user agent may provide the description of the error based on technology-specific, programmatically determined information. In both the cases ensure that the clear suggestions are provided for the user to correct the mistakes and re-submit the form.
In all the cases providing the suggestions for fields in error is not possible. For instance, When the form contains financial or legal data, or any other data that jeopardize the security providing suggestions for correction is not possible.
How to do
- The error message may contain the correct format if the data is a date field or email field. Eg: Enter the date in MM/DD/YYYY format.
- The error message may contain an example format in which the field can be filled. Eg: Provide the email address in correct format (email@example.com).
- The error message may contain invalid data that is not allowed by a password field. If the password field does not allow special character other than _ mention the same in the error statement. Ex: Password field cannot have the special character _(under score).
- If a field is filled with miss spelt word provide suggestions for the user with the list of possible values allowing them to correct. Eg: If the name of the city is miss spelt the error message could be “Do you mean any of the following cities? City 1, City 2, City3, City 4”. If possible allow the user to click the choice so the field can be filled automatically avoiding the user to repeat the mistake.
- If a mandatory field is omitted, the error message can be, “Field name cannot be left blank”.
People with learning difficulties will be able to identify and will have a way to correct the mistake. People with motor difficulties can avoid repeatedly changing the data and submitting the form. Blind and visually challenged users will exactly know the mistake they have done and be able to correct the fields in error.
WCAG 2.0 Techniques
- G83: Providing text descriptions to identify required fields that were not completed
- G84: Providing a text description when the user provides information that is not in the list of allowed values
- G85: Providing a text description when user input falls outside the required format or values
- G177: Providing suggested correction text