2 Replies Latest reply on Aug 30, 2006 5:17 AM by AirParker

    Form - Radio buttons

    AirParker Level 1
      I've built a form and it has 6 sets(each set is 2 button- like yes or no) of radio buttons.

      I've tested the page, checked a radio box - everything was fine, but then why i've tried to check another radio box, the last box got unchecked.

      And has i said i ment to build 6 radio button sets and not 1 set of 12 buttons.

      thats the code:

      <form id="form1" name="form1" method="post" action="">
      <fieldset>
      <legend>abc </legend>
      <Label>ABC
      <select name="select1" id="select1">
      <option value="a">AA</option>
      <option value="b">BB</option>
      <option value="c">CC</option>
      <option value="d">DD</option>
      <option value="e">EE</option>
      <option value="f">FF</option>
      </select>

      1
      <input type="radio" name="RadioGroup1" value="1" />
      2
      <input type="radio" name="RadioGroup1" value="2" />
      <br />
      </label>
      <Label>ABC
      <select name="select2" id="select2">
      <option value="a">aa</option>
      <option value="b">bb</option>
      <option value="c">cc</option>
      <option value="d">dd</option>
      <option value="e">ee</option>
      <option value="f">ff</option>
      </select>
      1
      <input type="radio" name="RadioGroup1" value="1" />
      2
      <input type="radio" name="RadioGroup1" value="2" /></Label>
      <br />
      <Label>ABC
      <select name="select3" id="select3">
      <option value="a">aa</option>
      <option value="b">bb</option>
      <option value="c">cc</option>
      <option value="d">dd</option>
      <option value="e">ee</option>
      <option value="f">ff</option>
      </select>
      1
      <input type="radio" name="RadioGroup1" value="1" />
      2
      <input type="radio" name="RadioGroup1" value="2" /></Label>
      <br />
      <Label>ABC
      <select name="select4" id="select4">
      <option value="a">aa</option>
      <option value="b">bb</option>
      <option value="c">cc</option>
      <option value="d">dd</option>
      <option value="e">ee</option>
      <option value="f">ff</option>
      <option value="g">gg</option>
      </select>
      1
      <input type="radio" name="RadioGroup1" value="1" />
      2
      <input type="radio" name="RadioGroup1" value="2" /></Label>
      <br />
      <Label>ABC
      <select name="select5" id="select5">
      <option value="a">aa</option>
      <option value="b">bb</option>
      <option value="c">cc</option>
      <option value="d">dd</option>
      <option value="e">ee</option>
      <option value="f">ff</option>
      <option value="g">gg</option>
      </select>
      1
      <input type="radio" name="RadioGroup1" value="1" />
      2
      <input type="radio" name="RadioGroup1" value="2" /></Label>
      <br />
      <Label>ABC
      <select name="select6" id="select6">
      <option value="a">aa</option>
      <option value="b">bb</option>
      <option value="c">cc</option>
      <option value="d">dd</option>
      <option value="e">ee</option>
      <option value="f">ff</option>
      <option value="g">gg</option>
      </select>

      1
      <input type="radio" name="RadioGroup1" value="1" />
      2
      <input type="radio" name="RadioGroup1" value="2" /></Label>
      </fieldset>

      <fieldset>
      <legend>cde</legend>
      <p>
      <label>a 
      <input name="name" type="text" id="name" />
      </label>
      <br />
      <label>b  
      <input name="password" type="password" id="password" maxlength="6" />
      </label>
      <br />
      </p></fieldset>
      <p> </p>
      <fieldset>
      <legend>sr</legend>
      <p>
      <label>s
      <input type="submit" name="Submit" value="Submit" />
      </label>
           
      <label>r
      <input type="reset" name="Submit2" value="Reset" />
      </label>
      </p>
      </fieldset>
      </form>




        • 1. Re: Form - Radio buttons
          Level 7
          AirParker wrote:
          > I've tested the page, checked a radio box - everything was fine, but
          > then why i've tried to check another radio box, the last box got
          > unchecked.

          <snip>
          > 1
          > <input type="radio" name="RadioGroup1" value="1" />
          > 2
          > <input type="radio" name="RadioGroup1" value="2" />

          <snip>

          > <input type="radio" name="RadioGroup1" value="1" />
          > 2
          > <input type="radio" name="RadioGroup1" value="2" /></Label>

          <snip>

          > <input type="radio" name="RadioGroup1" value="1" />
          > 2
          > <input type="radio" name="RadioGroup1" value="2" /></Label>

          <etc....>

          All your radio buttons are in the same group - RadioGroup1. Only one radio
          button in a group can be selected.

          Solution: Name the first pair 'RadioGroup1', then the second pair
          'RadioGroup2' etc, and all will be well.

          HTH,

          Pete.
          --
          Peter Connolly
          http://www.acutecomputing.co.uk
          Derby
          UK
          Skype ID: acutecomputing


          • 2. Re: Form - Radio buttons
            AirParker Level 1
            Oh right, its was pretty obviuos, i've just haven't used forms for a long time, thx .

            quote:

            Originally posted by: Newsgroup User
            AirParker wrote:
            > I've tested the page, checked a radio box - everything was fine, but
            > then why i've tried to check another radio box, the last box got
            > unchecked.

            <snip>
            > 1
            > <input type="radio" name="RadioGroup1" value="1" />
            > 2
            > <input type="radio" name="RadioGroup1" value="2" />

            <snip>

            > <input type="radio" name="RadioGroup1" value="1" />
            > 2
            > <input type="radio" name="RadioGroup1" value="2" /></Label>

            <snip>

            > <input type="radio" name="RadioGroup1" value="1" />
            > 2
            > <input type="radio" name="RadioGroup1" value="2" /></Label>

            <etc....>

            All your radio buttons are in the same group - RadioGroup1. Only one radio
            button in a group can be selected.

            Solution: Name the first pair 'RadioGroup1', then the second pair
            'RadioGroup2' etc, and all will be well.

            HTH,

            Pete.
            --
            Peter Connolly
            http://www.acutecomputing.co.uk
            Derby
            UK
            Skype ID: acutecomputing