Skip past header
Nevada Department of Transportation Go to State of Nevada Homepage
Jim Gibbons
Governor
Susan Martinovich, P.E.
Director
 

Example 14. Electonic forms


14. When electronic forms are designed to be completed on-line, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues. (508:N. No W3C checkpoint)

Visually, the above form is part of a table and each field is carefully placed in table cells adjacent to their corresponding labels (n.b. formatting forms with tables are by no means the only situation presenting the accessibility problems inherent in forms; tables merely illustrate the problem most clearly).

While the relationship between the titles "First Name" or "Last Name" and their respective input boxes may be obvious from visual inspection, the relationship is not obvious to a screen reader. Instead, a screen reader may simply announce "input box" when encountering each input box. The reason for these difficulties is revealed from inspecting the HTML source for this table. The following code is a simplified version of this table.

<form>
<table>
<tr>
<td><strong>FIRST NAME: </strong></td>
<td><input type="text" name="FIRSTNAME" /> </td>
</tr>
<tr>
<td><strong>LAST NAME: </strong></td>
<td><input type="text" name="LASTNAME" /> </td>
</tr>
</table>
<p>
<input type="submit" value="submit" />
</form>

The two pairs of form elements are indicated in bold above. The problem created by laying out form elements inside of this table is now clear – the form elements are separated from their labels by the formatting instructions for the table.

How can developers provide accessible HTML forms?
The first rule of thumb is to place labels adjacent to input fields, not in separate cells of a table. For the web developer who does not wish to place form elements immediately adjacent to their corresponding titles, the HTML 4.0 specification includes the <LABEL> tag that lets web developers mark specific elements as "labels" and then associate a form element with that label. There are generally two ways to use the label tag: explicit labels and implicit labels.

"Explicit Labels" Work Well
Experience has shown that explicit labeling works extremely well with all popular assistive technology and are recommended in all but the very simplest of tables. We recommend that all agencies ensure that their web developers are familiar with these important concepts. Using "explicit" labels involves two distinct steps:

<form>
<table>
<tr>
<td><strong><label for="first"> FIRST NAME:</label> </strong></td>
<td><input type="text" name="FIRSTNAME" id="first" /></td>
</tr>
<tr>
<td><strong><label for="last"> LAST NAME:</label> </strong></td>
<td><input type="text" name="LASTNAME" id="last" /></td>
</tr>
</table>
<p>
<input type="submit" value="submit" />
</form>

In a nutshell, that's all there is to making HTML form elements accessible to assistive technology. Experience has shown that this technique works extremely well in much more complicated and convoluted forms and it should work well in all agency HTML forms.

Avoid Using "Implicit Labels"
In "implicit" labels, the form element and its associated label are contained within an opening <label> tag and a closing </label> tag. For instance, in the table above, an implicit label to associate the words "First Name" with its associated input cell, we could use an implicit label as follows:

<label >
<tr>
<td><strong>FIRST NAME:</strong></td>
<td><input type="text" name="FIRSTNAME" /></td>
</tr>
</label >

Experience has shown that implicit labeling should be avoided for two reasons. First, implicit labeling is not reliably supported by many screen readers and, in particular, does not work well if explicit labels are simultaneously used anywhere on the same web page. Often, the output can be wildly inaccurate and confusing. Second, if any text separates a label from its associated form element, an implicit label becomes impractical and confusing because the label itself is no longer easily identified with the form element.



1263 South Stewart Street, Carson City, Nevada 89712 - Telephone: 775-888-7000 - Fax: 775-888-7115 - Email: info@dot.state.nv.us
Copyright © 1998 - 2010 Nevada Department of Transportation
Valid HTML 4.01! Valid CSS!