Techniques for WCAG 2.0

On this page:

-

# F86: Failure of Success Criterion 4.1.2 due to not providing names for each part of a multi-part form field, such as a US telephone number

## Applicability

General

This failure relates to:

- Success Criterion 4.1.2 (Name, Role, Value)
  - How to Meet 4.1.2 (Name, Role, Value)
  - Understanding Success Criterion 4.1.2 (Name, Role, Value)

## Description

This describes a failure condition of Success Criterion 4.1.2 where some or all of the parts of multi-part form field do not have names. Often there is a label for the multi-part field, which is either programatically associated with the first part, or not programatically associated with any parts.

Note: A name does not necessarily have to be visible, but is visible to assistive technologies.

## Examples

### Failure Example 1

A US telephone number consists of a 3-digit area code, a 3-digit prefix, and a 4-digit suffix. They are typically formatted as follows ([area code]) [prefix]-[suffix], such as (206) 555-1212. Often, forms asking for a telephone number will include 3 separate fields, but with a single label, such as:

Example Code:

    Phone number:
    (<input type="text" size="3">) <input type="text" size="3">-<input type="text" size="4">

The failure occurs when there is not a name for each of the 3 fields in the Accessibility API. A user with assistive technology will experience these as three undefined text fields. Some assistive technologies will read the punctuation as identification for the text fields, which can be even more confusing. In the case of a 3-field US phone number, some assistive technologies would name the fields "(", ")" and "-", which is not very useful.

### Failure Example 2

The same US telephone number. In this case, the label is not programatically associated with any of the parts. Phone number:

Example Code:

    (<input type="text" size="3">) <input type="text" size="3">-<input type="text" size="4">

A user with assistive technology will experience these as three undefined text fields.

### Failure Example 3

The same US telephone number. In this case, the label is programatically associated with the first part.

Example Code:

    <label for="area">Phone number:</label>
    (<input id="area" type="text" size="3">) <input type="text" size="3">-<input type="text" size="4">

A user with assistive technology will be led to believe that the first field is for the entire phone number, and will experience the second and third fields as undefined text fields.

## Resources

Resources are for information purposes only, no endorsement implied.

- Microsoft Active Accessibility 2.0 SDK. Includes Inspect32.exe and other MSAA tools.

- Gnome Accessibility Toolkit documentation

- Gnome Accessibility QA documentation and tools

- Microsoft Internet Explorer Developer Toolbar. Allows examination of script-generated DOM in Microsoft Internet Explorer.

- Firebug. Allows examination of script-generated DOM in Firefox.

## Related Techniques

- H44: Using label elements to associate text labels with form controls
- H71: Providing a description for groups of form controls using fieldset and legend elements
- H65: Using the title attribute to identify form controls when the label element cannot be used

## Tests

### Procedure

General Procedure:

1. Install a tool that allows you to view the accessibility API for your platform (see Resources section)

2. Find each form control

3. Check that the name property for each control is populated

Alternative Procedure for HTML and XHTML:

1. Find each `input`, `select`, and `textarea` element in the HTML source

2. Check that there is a title attribute on the element

3. Check that there is an associated `label` element

### Expected Results

General Procedure:

- If check #3 is false, then the failure condition applies and the content fails this success criterion.

Alternative Procedure for HTML and XHTML:

- If checks #2 and #3 are false, then the failure condition applies and the content fails the success criterion.

- Top
- Contents
- Intro
- Previous: Failure F85
- Next: Failure F87