WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: indicating required field when using asp.net label control

for

From: Peter Krantz
Date: Nov 5, 2008 12:25PM


On Wed, Nov 5, 2008 at 7:39 PM, Angela French < <EMAIL REMOVED> > wrote:
> Hello,
>
> Can anyone tell me if putting the "required field" text between the
> label and the form element presents any accessibility issues for screen
> readers? IN other words, even though it is just after the label can
> they still understand what is required?

Since some assistive technology make use of the text in the label
element it is best if the "required" flag (however you are flagging
it) is inside the label. See:

http://www.webaim.org/techniques/formvalidation/

>
> <label id="txtFirstName">(required field)</label> and never renders
> the First Name text.
>

I remember that it was best not to use asp:label and instead go with
the generic elements like this:

<label for='<%= txtFirstName.ClientID %>'>Whatever...</label>

Regards,

Peter Krantz
http://www.standards-schmandards.com/