Menu

Multiple selection of radio buttons

Help
2002-10-29
2013-06-03
  • Ruediger Arp

    Ruediger Arp - 2002-10-29

    Hello,

    It did take me a few hours but now I've got it working the way I want it to save one small issue:
    Is it possible to have a visitor check more than one radio button whithin a given set of choices?

    Unfortunately I cannot provide a link as I am constantly recreating my form right now so I'll try to illustrate it in more detail:
    The first item in my form says "I am interested in..." followed by four radio button "answers". At the moment, I can only select one of these four.

    TIA,
    Ruediger

    P.S.  Great script, this is exactly what I've been looking for!

     
    • Musawir Ali

      Musawir Ali - 2002-10-29

      The radio buttons are mostly used in places where you have choices and only one choice is supposed to be selected. If you allow more than one choices, you do one of two things:

      1) Use separate radio buttons of size of 1 for each of your answers (kinda impractical, not suggested)

      2) or you can use checkboxes. Checkboxes are normally used for these kind of situations. Create 4 checkboxes for the 4 choices.

      In any case, i'm afraid, you will need to enter the "I'm interested in ... " to your form manually by editing the .html file. :P

       
    • Ruediger Arp

      Ruediger Arp - 2002-10-30

      > or you can use checkboxes.
      Doh...
      I first thought I would get away by replacing "type=radio" with "type=checkbox" in the .html.
      It looks good, but the notification email always displays only one of several ticked checkboxes.
      I then tried to just recreate the form, this time using 4 checkboxes instead of radio buttons (4 in "Field size1").
      The checkboxes however won't be displayed in the final form.

       
    • Musawir Ali

      Musawir Ali - 2002-10-30

      yep, thats not how they're supposed to work. A checkbox with size 4 doesn't mean much :P A checkbox is one complete field type on its own, it cannot be associated with anything. So when you create the radio buttons, and replace the type with checkbox, you have converted each of the radio buttons to 4 separate checkboxes with the same name. So only one of them will be sent.
      For now, the only work around is the one i mentioned. I'll see if I can think up of a more intuitive way to do this, without having to manually edit the html code.

       
    • Ruediger Arp

      Ruediger Arp - 2002-10-31

      Thanks again, and yes, I still need to learn some basic concepts :)

      Anyhow, I can live with using radio buttons, all I need to do is adding a button called "Miscellaneous".

      It might not be the right place here for suggestions but what about adding a "showcases" section to your website?

       
    • mike ca

      mike ca - 2008-02-26

      I created a form with check boxes.
      but now decided I only want to allow 1 to be checked..
      I tried switching type=checkbox to type=radio.

      it changed the boxes to radio buttons but you can select more than 1.
      is there code I could add to deny more than 1 ?

      I tried java script.. for some reason it allows you to check a box or radio button but then you cant uncheck it and it allows more than one.

       
      • TNTEverett

        TNTEverett - 2008-02-26

        You have it partially right.  A radio button has 3 basic properties, type, name, and value.  For the radio buttons to work you need the name to be the same for the group you want to have mutual exclusion (one button selected only). 
        <input type="radio" name="group1" value="choice1">
        <input type="radio" name="group1" value="choice2">
        <input type="radio" name="group1" value="choice3">

        The result will be
        group1=choice{n}

        Your old check boxes have unique names. 

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.