kajj Posted May 23, 2007 Share Posted May 23, 2007 Hi, I have the following radio buttons: <input type="radio" name="R5" value="1" checked> All<BR> <input type="radio" name="R5" value="2"> Current<BR> <input type="radio" name="R5" value="3"> Not Current<BR> <input type="radio" name="R5" value="4"> Prior<BR> <input type="radio" name="R5" value="5"> New<BR> I am trying to disable them with no luck. I am using the following function: function ExternalData() { var the_box = window.document.form1.R32; var the_switch = ""; if (the_box.checked == true) { document.form1.R5.disabled = true ; document.form1.R6.disabled = true ; document.form1.R7.disabled = true ; document.form1.R10.disabled = true ; document.form1.R27.disabled = true ; document.form1.R28.disabled = true ; } else { document.form1.R5.disabled = false ; document.form1.R6.disabled = false ; document.form1.R7.disabled = false ; document.form1.R10.disabled = false ; document.form1.R27.disabled = false ; document.form1.R28.disabled = false ; } } R10, R27, and R28 are checkboxes and dropdowns that disable correctly but I can't get the radio buttons to disable. I'm fairly new to Javascript and I'm quite lost on how to do this. Someone suggested using getelementbyid but everything I have looked at for that is a bit confusing. Any help would be appreciated. Thanks. Quote Link to comment Share on other sites More sharing options...
kajj Posted May 23, 2007 Author Share Posted May 23, 2007 After much trial and error, I finally got this to work. I added IDs to all of my radio buttons and added the following code to the top of my function: document.getElementById('IDR51').disabled= checked; document.getElementById('IDR52').disabled= checked; document.getElementById('IDR53').disabled= checked; document.getElementById('IDR54').disabled= checked; document.getElementById('IDR55').disabled= checked; document.getElementById('IDR61').disabled= checked; document.getElementById('IDR62').disabled= checked; document.getElementById('IDR63').disabled= checked; document.getElementById('IDR71').disabled= checked; document.getElementById('IDR72').disabled= checked; document.getElementById('IDR73').disabled= checked; It is now turning the buttons on and off as needed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.