[RESOLVED] Adding Labels to Radio Button Array
Hi,
I've got a radio button control array and want to add labels to the options so that you can click the text to select the option
Code:
...
<td>
<input type="radio" name="rblCorrespType" id="rblCorrespType" value="email"><label for="rblCorrespType">Email</label>
<input type="radio" name="rblCorrespType" id="rblCorrespType" value="letter"><label for="rblCorrespType">Letter</label>
<input type="radio" name="rblCorrespType" id="rblCorrespType" value="fax" checked="true"><label for="rblCorrespType">Fax</label>
</td>
...
Does anyone know how to do this, other than giving each radio button it's own name?
I've tried the following -
Code:
for="rblCorrespType(2)"
for="rblCorrespType[2]"
for="fax" <-- value
Cheers Al
Re: Adding Labels to Radio Button Array
You cannot have more than one item with the same ID. There is no such thing as a control array, you group the radio buttons using the name attribute, give them different IDs, and use the corresponding ID in the for attribute of the label. :)
Edit: So your code would be
HTML Code:
...
<td>
<input type="radio" name="rblCorrespType" id="rblCorrespType1" value="email"><label for="rblCorrespType1">Email</label>
<input type="radio" name="rblCorrespType" id="rblCorrespType2" value="letter"><label for="rblCorrespType2">Letter</label>
<input type="radio" name="rblCorrespType" id="rblCorrespType3" value="fax" checked="true"><label for="rblCorrespType3">Fax</label>
</td>
...
Re: Adding Labels to Radio Button Array
Penagate,
That's worked thanks!
Cheers Al