Radio Buttons enabling and disabling check boxes

Results 1 to 2 of 2

Thread: Radio Buttons enabling and disabling check boxes

  1. #1
    Join Date
    Dec 1969

    Default Radio Buttons enabling and disabling check boxes

    &nbsp;<BR>Hi,<BR><BR>I am trying to have a set of radio buttons and a corresponding list of check boxes which would be enabled or disabled depending on what radio buttons are chosen. I created a code which would enable a group of checkboxes when a particular radio button is chosen. But within the checkboxes I am unable to code so that only one checkbox withing the group of checkboxes alone could be chosen. I would appreciate any help on it. Here is my code:<BR><BR>&#060;HTML&#062;<BR>&#060;HEAD&#062;< BR><BR>&#060;SCRIPT LANGUAGE="JavaScript"&#062;<BR><BR>function validate_checkbox(val) {<BR>frm=document.forms[0]<BR>if(val=="checkbox 1") <BR>{<BR>alert(&#039;correct&#039;)<BR>}<BR>if(val =="checkbox 2") <BR>{<BR>alert(&#039;correct&#039;)<BR>}<BR>if(val =="checkbox 3") <BR>{<BR>alert(&#039;correct&#039;)<BR>}<BR>}<BR>< BR><BR>function Disab (val) {<BR>frm=document.forms[0]<BR><BR>if(val=="option 1") <BR>{<BR>frm.checkbox1.disabled=false<BR>frm.check box2.disabled=false;<BR>frm.checkbox3.disabled=fal se;<BR>frm.checkbox4.disabled=true;<BR>frm.checkbo x5.disabled=true;<BR>frm.checkbox6.disabled=true;< BR>frm.checkbox7.disabled=true;<BR>frm.checkbox8.d isabled=true;<BR>frm.checkbox9.disabled=true;<BR>} <BR><BR>if(val=="option 2") <BR>{<BR>frm.checkbox1.disabled=true;<BR>frm.check box2.disabled=true;<BR>frm.checkbox3.disabled=true ;<BR>frm.checkbox4.disabled=false;<BR>frm.checkbox 5.disabled=false;<BR>frm.checkbox6.disabled=false; <BR>frm.checkbox7.disabled=true;<BR>frm.checkbox8. disabled=true;<BR>frm.checkbox9.disabled=true;<BR> }<BR>if(val=="option 3") <BR>{<BR>frm.checkbox1.disabled=true;<BR>frm.check box2.disabled=true;<BR>frm.checkbox3.disabled=true ;<BR>frm.checkbox4.disabled=true;<BR>frm.checkbox5 .disabled=true;<BR>frm.checkbox6.disabled=true;<BR >frm.checkbox7.disabled=false;<BR>frm.checkbox8.di sabled=false;<BR>frm.checkbox9.disabled=false;<BR> }<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Radio Buttons enabling and disabling check box

    if you want them only to choose ONE option, is there a reason you&#039;re not using radio buttons instead?

Posting Permissions

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