W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > October to December 2002

Question about form labels and radio buttons.

From: Mirabella, Mathew J <Mathew.Mirabella@team.telstra.com>
Date: Wed, 13 Nov 2002 11:15:37 +1100
Message-ID: <73388857A695D31197EF00508B08F2980A00EA40@ntmsg0131.corpmail.telstra.com.au>
To: "'W3C-WAI-IG List'" <w3c-wai-ig@w3.org>


Maybe I am forgetting something simple here.  A quick question regarding
labels for radio buttons in XHTML 1.0.

Normally, name= attributes of the input elements are used to indicate the
grouping.  i.e. name="sex" value="female".  And of course the value=
attributes differ for each radio button to provide the name/value pair.

However, in using the label element to associate the on-screen text as a
label for the control, each radio button in fact has a different label.
This is ok because we use the id= attribute to link each radio button to its
	...<label for="female">Female <input type="radio" name="sex"
id="female" value="female" /></label>...
	...<label for="male">Male <input type="radio" name="sex" id="male"
value="male" /></label>...

The issue is that in XHTML 1.0, the name= attribute is replaced by the id=
attribute.  So without the name= attribute, how do we:
1.  Code the grouping of the controls with name/value pairs? (I assume that
id takes over from name here??).
2.  Create different explicitly associated labels for each radio button (an
issue since now the id attribute has to reflect the grouping).

In 2. above, do we suggest that the value= attribute takes over from the id=
attribute in its linking to the for= attribute of the label element?  If so,
how are user agents and technologies such as screen readers accommodating
this? (since they normally use id/for links rather than value/for links
between input and label elements).

Do we now take radio buttons (and thus perhaps checkboxes as well) to be
controls which in fact have explicit labels contained within them via the
value= attribute (cf. submit and reset input types)?  If so, do we say that
label elements are not required for radio buttons?

The difficulty is that the real label for a radio button appears on the
screen, and thus normally you would use label to connect the label to the
control as with checkboxes and edit fields.

Are we going down a path where we want user agents to render the contents of
the value= attribute on-screen?  Or do we just code our radio buttons
without labels, and leave it to the adaptive technology to use value=
attributes, ensuring that in the code, the on-screen label approximates (or
is equivalent to) the value= attribute?

Any information on this would be helpful.

Received on Tuesday, 12 November 2002 19:17:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 13 October 2015 16:21:21 UTC