Re: Form elements discrepancy

Ming Teo wrote:
> I had a concern regarding the use of checkboxes and radio buttons. Firstly, as 
> every form element should have a label with attribute for="form_element", and 
> every input thus has a name with attribute name="form_element", the use of 
> checkboxes and radio buttons fails.

The for attribute refers to the value of an id attribute, not a name 
attribute.

> <label for="choose">First Option</label> <input type="radio" name="choose" 
> value="First Option" />
> <label for="choose">Second Option</label> <input type="radio" name="choose" 
> value="Second Option" />

That should be something like this:

<label for="choose-first">First Option</label>
   <input type="radio" name="choose" id="choose-first" value="First 
Option" />
<label for="choose-second">Second Option</label>
   <input type="radio" name="choose" id="choose-second" value="Second 
Option" />

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Friday, 30 September 2005 23:48:33 UTC