WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Form validation - on submit or on each required field

for

From: Bryan Garaventa
Date: Jun 26, 2014 2:03PM


If the page doesn't refresh, you can optionally dynamically add aria-describedby to the first form field in error before setting
focus to it via .focus(), and have aria-describedby point to the ID of the error container that relates to it.

This then allows the user to hear the error text, and gives them the ability to type directly into the field with the error without
having to hunt for it.

If more than one field is in error, as the user tabs through the form again, the error associated with the field via
aria-describedby will be announced.