No announcement yet.

Radio buttons

  • Filter
  • Time
  • Show
Clear All
new posts

  • Radio buttons

    I had such good results from my last question I'd now like to ask,

    I have specific profile fields in its own template using the profile.php script.
    I am having a problem with radio buttons used for shirt sizes.
    The radio button selection is saved but how do I show the radio button as checked the next time I visit the page.
    Attached is what the page looks like.
    HTML Code:
    <label for="rb_cpf_field26_1"><input type="radio" name="userfield[field26]" value="1" id="rb_cpf_field26_1" />S</label> &nbsp;
    <label for="rb_cpf_field26_2"><input type="radio" name="userfield[field26]" value="2" id="rb_cpf_field26_2" />M</label> &nbsp;
    <label for="rb_cpf_field26_3"><input type="radio" name="userfield[field26]" value="3" id="rb_cpf_field26_3" />L</label> &nbsp;
    <label for="rb_cpf_field26_4"><input type="radio" name="userfield[field26]" value="4" id="rb_cpf_field26_4" />XL</label> &nbsp;
    <label for="rb_cpf_field26_5"><input type="radio" name="userfield[field26]" value="5" id="rb_cpf_field26_5" />XXL</label> &nbsp;
    Attached Files
    ...steven (vB3.8) | (vB4.2) |
    "I tried to clean this up but this thread is beyond redemption." - Steve Machol

  • #2
    Just to clarify are you wanting the buttons that are squared that you can check instead of circle ones where you can only pick one choice?


    • #3
      Now I'm confused.

      I have a field for t-shirt size that uses radio buttons.
      { } S { } M { } L { } XL { } XXL

      I use this field value on another layout so I know when someone clicks on a size it is written to the database.
      What I want is for when the user comes back to this page to see his/her choice.

      { } S { } M {•} L { } XL { } XXL for Large.

      Edit: My guess is I need something like
      HTML Code:
      <label for="rb_cpf_{$profilefieldname}_$key"><input type="radio" name="userfield[$profilefieldname]" value="$key" id="rb_cpf_{$profilefieldname}_$key" $checked />$val</label>
      Last edited by steven s; Mon 9 Jan '06, 7:01pm.
      ...steven (vB3.8) | (vB4.2) |
      "I tried to clean this up but this thread is beyond redemption." - Steve Machol


      • #4
        I need to fix a similar problem with a menu selection box.
        Somewhere I need to show what is checked for when the person comes back to the page.
        When a user comes back to this page the top option is always display. I need to to display whatever option is stored.

        HTML Code:
        <td class="alt1" valign="top"><select name="userfield[field24]" size="1">
        <option value="National Capital">National Capital</option>
        <option value="non-member">non-member</option>
        <option value="Allegheny">Allegheny</option>
        ...steven (vB3.8) | (vB4.2) |
        "I tried to clean this up but this thread is beyond redemption." - Steve Machol


        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.