Click to See Complete Forum and Search --> : [RESOLVED] Forms and labels (about the for property)


3ARRANO
10-11-2006, 05:56 AM
Hello,

I've got a form with a label like this:

<label for="day">birthday</label>
<select name="year">
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
...
</select>
<select name="month">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
...
</select>
<select name="day">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
...
</select>


What I want is the label to be for the three selects, and not only for "day". But I don't know if that's possible.

I want to validate XHTML 1.0 Strict.


Lots of thanks,

Charles
10-11-2006, 06:07 AM
The LABEL and the xhtml:label elements are only good for one form control each. You want to use the FIELDSET/xhtml:fieldset element.<fieldset>
<legend>Birthday</legend>
<label>Year <select name="year">
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
...
</select></label>
<label>Month <select name="month">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
...
</select></label>
<label>Day <select name="day">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
...
</select></label>
</fieldset>

3ARRANO
10-11-2006, 06:13 AM
Ok. Thanks for replying so quickly!