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

RE: Accessible forms in XHTML

From: Rebecca Cox <rebecca@cwa.co.nz>
Date: Thu, 18 Jul 2002 10:34:32 +1200
Message-Id: <a05100303b95b9dc959e9@[10.10.10.129]>
To: "Andrew Johns" <andrew.johns@jkd.co.uk>, <w3c-wai-ig@w3.org>

At 10:50 AM +0100 7/17/02, Andrew Johns wrote:
>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?

They can be the same. Usually in html 4, you would use "name" to 
identify form fields (used by the script that processes the form) and 
id to pair up your <label> elements with their form fields, so it 
wouldn't be a problem if they both had the same value.  This is still 
OK in xhtml.

"id" must be a unique value within the HTML page, whereas "name" only 
needs to be unique within each form, so this is why they are 
different in some cases. (eg lots of forms in one page might have 
<input type="text" name="email" />

If your form works as intended & code validates, then its all good:-)






>
>
>
>"Andrew Johns" <andrew.johns@jkd.co.uk> wrote:
>
>>  On researching information for what makes a form more accessible, 
>>I came across many examples of <label> tags, whereby an id and name 
>>are both set, but usually different.
>>
>>  an example being:
>>
>>  <label for="label">A label:</label><input type="text" id="label" name="txt">
Received on Wednesday, 17 July 2002 18:34:52 GMT

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