SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Echo a radio button, no functionality

    Hi when I echo a radio button to the client page from the server, the radio button isn't 'selectable'.


    echo "<div class='container'><input type='checkbox' id='pr2' value='" .$one . "' />" . $one . "</div>";



    Any idea why?

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Well first of all, you're not echoing a radio button, you're echoing a checkbox.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry I meant to change that to radio button.

    I was testing it with checkbox and it worked. But for some reason radio buttons don't work

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    So by 'isnt selectable' you mean it's Disabled? (Greyed out) Or... you're trying to programmatically select it and cant?

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it's not greyed out. When I try and select it manually, it just doesn't fill with the black dot.

    I wonder if it's to do with me sending a html element to the client from the server.

  6. #6
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Let me guess. You're using IE.
    Try giving the radio button a NAME attribute.

  7. #7
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    Let me guess. You're using IE.
    Try giving the radio button a NAME attribute.
    Yep, using IE

    Could you give an exmple of a NAME attribute please.

  8. #8
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're right. I tried it in Firefox and it works fine

  9. #9
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    <input type='checkbox' id='pr2' name='pr2' value='" .$one . "' />"

    It's a known bug in IE that radio buttons without a name attribute cease to function. It's slated for fixing in IE9.

  10. #10
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great, thanks for your help


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •