WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Form error messages (asp.net 4)

for

From: Paul J. Adam
Date: May 2, 2013 6:51PM


I don't recommend connecting 2 labels to 1 input. It worked in most browsers/AT but not all. I'd have to test them all again to remember which combinations failed.

The jQuery Validation plugin inserts an extra label by default so I had to tweak it to insert the error into the original label.

Paul J. Adam
Accessibility Evangelist
www.deque.com

On May 2, 2013, at 7:07 PM, Angela French < <EMAIL REMOVED> > wrote:

>> Inserting errors into the connected label is the bullet-proof method that would
>> work on any user agents with no aria support.
>>
>>
>>
>> Paul J. Adam
>> Accessibility Evangelist
>> www.deque.com
>>
>>
>
> Thanks Paul.
> I'm curious - I know that the html spec allows for two labels for an input tag. How do screen readers handle two labels associated with one element? Assuming my html coding is correct (I've never done two labels with one input), how would my example be heard?
>
> <label for="firstname">First Name:</label><input type="text" id="firstname" /><label for="firstname">You forgot to enter your first name</label>
>
> Angela French
>
>
>
> > >