Results 1 to 3 of 3

Thread: [RESOLVED] Adding Labels to Radio Button Array

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Resolved [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>&nbsp;
    <input type="radio" name="rblCorrespType" id="rblCorrespType" value="letter"><label for="rblCorrespType">Letter</label>&nbsp;
    <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

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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>&nbsp;
    <input type="radio" name="rblCorrespType" id="rblCorrespType2" value="letter"><label for="rblCorrespType2">Letter</label>&nbsp;
    <input type="radio" name="rblCorrespType" id="rblCorrespType3" value="fax" checked="true"><label for="rblCorrespType3">Fax</label>
    </td>
    ...

  3. #3

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    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
  •  



Click Here to Expand Forum to Full Width