RE: Accessible forms in XHTML

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 UTC