WebAIM - Web Accessibility In Mind

E-mail List Archives

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


From: Jukka K. Korpela
Date: Jun 26, 2014 8:31AM

2014-06-26 17:05, Liko, Todd wrote:

> I am seeking your thoughts on which type of form validation is
> preferred. A form with required fields (with proper notifications)
> can be validated server side when submitting the form or each field
> can be validated while completing the form.

There are strong reasons to check data both when it is entered, in a
browser, and after it has been entered and submitted, in the server. The
latter is needed for data security and often also to run some tests that
can only be run server-side.

> With validation on submit, if there are errors, the form is refreshed
> with the focus returning to the top of the form where the errors are
> listed. When validating each field while completing the form, the
> user is notified of the error right away and focus is returned to the
> field.
> In my opinion, both methods meet WCAG 2.0. However, keeping usability
> in mind, is there a preference to which method is used.

WCAG 2.0 seems to be silent about this issue. But if we put
accessibility recommendations aside and think of accessibility, it is
rather evident that mostly an error message should be issued as early as
possible, i.e. client-side. The reason is that getting a message right
after entering incorrect data makes it clear what the message relates
to. The user still has the specific question and answer in his mind and
he is better prepared to making a correction than after having dealt
with perhaps dozens of other questions in the meantime.

If error messages are issued only after all data has been entered, it
can be very difficult to relate them to what the user did. This applies
particularly to people with cognitive disabilities. An additional point
is that if a user sees a large number of error messages, he may get
disturbed and distressed, perhaps thinking he can never have all the
errors corrected - even though he could well deal with them if presented
one at a time.

However, some people might prefer entering all the data first, then
getting feedback of what went wrong and correcting the mistakes. It
would of course be technically possible to have an option "do not check
input data when typing" or something like that, but to most people, that
would be an unnecessary, possibly problematic option.