Accessible Forms

Jason Morningstar

UNC Chapel Hill | ITS Communications | Web Services

Goals

Basics

Usability

LABEL

FIELDSET

LEGEND

Javascript

Bad Form! No Cookie!

First Name
Email
Home Phone
Middle Initial
Computer type
Work Phone
Last Name
Mac PC
Country
Internet speed 28.8 56k T1

Bad Form Reading Order

1
2
3
4
5
6
7
8
9
10
11
12
13
14

A Better Form

Computer Type


Internet Speed


PEEKING AT THE CODE: LABEL

<tr>
<td> <div style="/*/*/text-align: right;">
<label for="country">Country</label>
</div></td>
<td> <input id="country" type="text" name="textfield38" size="12" /> </td>
</tr>

MORE CODE: FIELDSET & LEGEND

<td style="background-color: rgb(204, 204, 255);"> <fieldset>
<legend>Internet Speed </legend>
<br />
<input id="l288" type="radio" name="radiobutton4" value="radiobutton" />
<label for="l288"> 28.8</label>
<br />
<input id="l56k" type="radio" name="radiobutton4" value="radiobutton" />
<label for="l56k">56k </label>
<br />
<input id="t1" type="radio" name="radiobutton4" value="radiobutton" />
<label for="t1">T1</label>
</fieldset></td>

INPUT

Here's the markup, y'all:

<label for="name">Name</label>
<input id="name" type="text" name="textfield">

TEXTAREA

Control type: TEXTAREA


Here's the HTML markup:

<label for="motives">Explain your motives:</label><br>
<textarea id="motives" name="textfield2"></textarea>

CHECKBOXES

Control type: CHECKBOXES

Choose a color:

<fieldset>
<legend>Choose a color:</legend><br>
<input id="blue" type="checkbox" name="checkbox" value="checkbox">
<label for="blue">Blue</label><br>
<input id="yellow" type="checkbox" name="checkbox2" value="checkbox">
<label for="yellow">Yellow</label>
</fieldset>

RADIO BUTTONS

Control type: RADIO BUTTONS

Choose a car:

<fieldset>
<legend>Choose a car:</legend><br>
<input id="dart" type="radio" name="radio" value="dart">
<label for="dart">Dodge Dart</label><br>
<input id="pinto" type="radio" name="radio" value="pinto">
<label for="pinto">Ford Pinto</label>
</fieldset>

SELECT

4.5 Control type: SELECT

Here's the HTML:

<label for="favcity">Which is your favorite city?</label>
<select id="favcity" name="favcity">
<option value="1">Amsterdam</option>
<option value="3">Interlaken</option>
<option value="4">Moscow</option>
</select>

BUTTON

4.6 Control Type: BUTTON

There are no special HTML tags for buttons. They are accessible as long as you use a standard button. Remember to use an ALT if the button is also an image!

Here's the markup:

<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">

Handy Links