← Back to guides

Identifying Input Purpose

Autocomplete tokens, and deciding whose information a field holds

Structure

When a form field asks for the person's own details, the field must say what it is asking for in a way a browser can read. That is what the autocomplete attribute does. With it, a browser or assistive tool fills the field in automatically. Without it, every person who fills in the form types their own name, address and phone number by hand, every time.

This is a Level AA requirement, and it is the one requirement no automated checker has ever reported. Published tools only check whether an attribute that is already there carries a valid value. A field with no attribute at all falls outside what they look at, which is why sites reported as clean on this criterion often are not.

What to avoid

<input type="text" name="name" id="name">
<input type="email" name="email" id="email" autocomplete="on">
<input type="tel" name="phone" id="phone" autocomplete="off">
Problems with this pattern
  • None of the three fields declares a purpose. The first has no attribute at all.
  • on and off are browser toggles, not purposes. They say whether the browser should try, not what the field holds.
  • autocomplete="on" is the default on every new element in Drupal Webform, so it is what you find when you open the panel. It looks like the helpful choice, writes nothing into the page, and satisfies nothing.

Best practice

<input type="text" name="name" id="name" autocomplete="name">
<input type="email" name="email" id="email" autocomplete="email">
<input type="tel" name="phone" id="phone" autocomplete="tel">
Why this works

Each field names the specific thing it collects, so a browser can fill all three in one action rather than leaving the person to type them.

Whose information is it?

This is the part that matters most, and the part no checklist can decide for you.

The criterion applies only to fields collecting information about the person filling in the form. Putting a purpose token on a field that asks for somebody else's details is its own failure, listed in WCAG as F107, because the browser will helpfully autofill the wrong person's information into it.

Library forms are full of these:

  • An emergency contact's phone number on a home delivery form
  • The name of an ancestor on a genealogy research request
  • A nominee on an award form
  • The address of the venue where an event will be held
  • A parent or guardian on a youth program registration

Every one of those looks identical in the markup to the patron's own equivalent field. A "City" box on an event location block and a "City" box on the patron's own address block are the same box. The difference is only in what the form is asking.

The question to ask of every field

If the browser fills this in with my own details, is that right? If the answer is no, leave the field alone. Leaving a field alone is always safe. Guessing is not.

Fields made of several boxes

Some form builders group related boxes into a single element. A "Basic address" element in Drupal Webform renders as six separate inputs sharing one name, like address[address], address[city] and address[postal_code].

These need particular attention, because the element editor offers no Autocomplete dropdown for them at all. There is no setting to miss, which means they are almost never set. They are fixed in the element's Custom properties instead, one line per sub-field.

Common tokens

The field asks forToken
Full namename
First namegiven-name
Middle name or initialadditional-name
Last namefamily-name
Email addressemail
Phone numbertel
Street address on one multiline boxstreet-address
Street address, first lineaddress-line1
Apartment, suite or unitaddress-line2
Cityaddress-level2
State or provinceaddress-level1
ZIP or postal codepostal-code
Countrycountry-name
Organizationorganization
Date of birthbday

A field that genuinely does two jobs, such as one box labeled "Phone/Email", cannot declare two purposes. Leaving that field alone is the defensible answer.

Why it matters

For someone with a tremor, a motor disability, or a memory-related disability, retyping the same personal details into every form is the difference between finishing it and abandoning it. Autofill is not a convenience for these users; it is what makes the form completable.

It also helps people with cognitive disabilities who find recalling and entering information difficult, and anyone using a screen reader or a switch device, where every keystroke costs more than it does with a keyboard and a mouse.

WCAG criteria

Referenced criteria
1.3.5 Identify Input Purpose (opens in a new tab) - The purpose of each input field collecting information about the user can be programmatically determined. AA
F107 Failure of 1.3.5 (opens in a new tab) - Setting an incorrect autocomplete value, including on a field that is not about the person filling in the form. Failure