|
-
Feb 9th, 2006, 12:16 PM
#1
Thread Starter
Fanatic Member
[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
-
Feb 9th, 2006, 01:06 PM
#2
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>
...
-
Feb 9th, 2006, 01:50 PM
#3
Thread Starter
Fanatic Member
Re: Adding Labels to Radio Button Array
Penagate,
That's worked thanks!
Cheers Al
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|