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

RE: Accessible forms in XHTML

From: RUST Randal <RRust@COVANSYS.com>
Date: Wed, 17 Jul 2002 07:36:44 -0400
Message-ID: <37925254B67DD311876C009027B0FF92027FC43A@cbscolex01.cbsinc.com>
To: w3c-wai-ig@w3.org

>but there IS a reason for the difference in values for the id 
>and name attributes? Is there a reason why they can't be the same?

Yes.  I ran into this very problem last week.  Let's assume that you have
this:

<p>Are You Working?</p>

<label for="workingYes">Yes</label>
<input type="radio" id="workingYes" name="workingYes" value="y" />

<label for="workingNo">No</label>
<input type="radio" id="workingNo" name="workingNo" value="n" />

Now this makes perfect sense, unless you don't know that checkboxes are
referenced in Javascript, PHP, etc. by an array.  In the above example, it
is possible to select both the Yes and No checkboxes.  Which doesn't work,
because you want Yes to be unchecked if No is checked.

So the markup has to look like this:

<p>Are You Working?</p>

<label for="workingYes">Yes</label>
<input type="radio" id="workingYes" name="working" value="y" />

<label for="workingNo">No</label>
<input type="radio" id="workingNo" name="working" value="n" />

Try it out and see for yourself.  Once you actually try to use the form, it
makes much more sense.

Randal
Received on Wednesday, 17 July 2002 07:40:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 19 July 2011 18:14:05 GMT