Web Analytics Made Easy -
StatCounter enabling of radio buttons and checkboxes - CodingForum

Announcement

Collapse
No announcement yet.

enabling of radio buttons and checkboxes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • enabling of radio buttons and checkboxes

    hello,

    I have a series of radio buttons and checkboxes in a form. what i would like to do is when a radio button is ticked, a checkbox corresponding to that radio button will also be enabled / ticked.

    Can anyone give me a hand on this?

    Thanks!

  • #2
    You have to show your html code for the radios and checkboxes for us to see the naming convention you used to associate a radio button to a particular checkbox.

    BTW, welcome to the CF forums my kababayan.
    Last edited by glenngv; Feb 26, 2004, 11:16 PM.
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      Try this:

      <form name= fm>
      <input type=radio name=r1>AM
      <input type=radio name=r1 onclick="document.fm.c1.checked=true">PM
      <input type=checkbox name=c1>
      </form>

      Comment


      • #4
        it would be easy to put it in a generic function.
        that's why I asked for the naming convention.

        <form name="fm">

        <input type="radio" name="r1" value="chk1" onclick="enableChk(this)">
        <input type="checkbox" name="chk1" disabled="disabled" />

        <input type="radio" name="r1" value="chk2" onclick="enableChk(this)" />
        <input type="checkbox" name="chk2" disabled="disabled" />

        <input type="radio" name="r1" value="chk3" onclick="enableChk(this)" />
        <input type="checkbox" name="chk3" disabled="disabled" />

        </form>

        then the script:
        Code:
        function enableChk(objR){
          var objC = objR.form.elements[objR.value];
          objC.disabled = false;
          objC.checked = true;
        }
        Glenn
        vBulletin Mods That Rock!

        Comment


        • #5
          thanks a lot for the help.

          Comment

          Working...
          X