Accessible Forms In .Net

7. January 2009

For an accessible web form one of the requirements is that input fields require explicit descriptions. The "for" attribute in the label element must be associated to the input id.

With Visual Studio this can be difficult to achieve. When using master pages Visual Studio renames the ids of the of the input fields to ensure they are unique within the master page. This means that the label tags are no longer associated with input fields.

To resolve this issue give the labels an id and runat="server" then in the Page Load put

labelid.Attributes.Add("for", textboxid.ClientID)

This fixes the accessibility issue of input fields having labels associated with them.

.Net, Accessibility ,

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading





Marketing & SEO Blogs - Blog Top SitesBlog Flux Directory Marketing / SEO Top Blogs Internet Marketing & SEO (Link Building) - TOP.ORG Add to Technorati Favorites TopOfBlogs