WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Forms - 1 label for 2 selects?

for

From: Jukka K. Korpela
Date: Aug 5, 2004 1:59PM


On Thu, 5 Aug 2004, awebster wrote:

> - - can I have one label for two inputs, as I have done below for
> "Expiry Date"?

No. Technically you could use Expiry Date:
... ...
but this doesn't really define labels. Each label is supposed to be a
label for one field: "Each LABEL element is associated with exactly one
form control." (From the HTML 4.01 specification,
http://www.w3.org/TR/html4/interact/forms.html#edef-LABEL )

> I don't really want to put Expiry Month and then Expiry Year.

And I, as a user, even without any disability that would considerably
affect my browsing, don't really want to select first a month from a
dropdown menu, then a year from another menu. And such things are
especially inconvenient on speech browsers, or when using keyboard-only
input. It's much simpler to _type_ the information.

And normally it should be possible to have just one text input field:

Please enter the expiry date of your credit card
exactly as printed on the card. This typically consists of
a month and a year separated by a slash, e.g. 04/05.
Expiry date: <input id="exp" type="text"
name="exp" size="7">

Then the form handler should take it from there. It needs to know the
formats used in the cards that are to be accepted, of course.

--
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/