iPixel Posted December 14, 2009 Share Posted December 14, 2009 Am i doing something wrong? 2 Radio Buttons... <input type="radio" name="form_status" id="form_status" value="Active" onchange="ETDF(this)" /> Active <input type="radio" name="form_status" id="form_status" value="InActive" onchange="ETDF(this)" /> InActive So if "Active" is selected... the field form_termdate has to be disabled, otherwise if InActive is selected the form_termdate field (textbox) has to be enabled. my JS. <script type="text/javascript"> if(document.getElementById("form_status") == "Active") { document.getElementByID("form_termdate").disabled = true; } function ETDF(action) // Enable Terminated Date Field { if(action == "Active") { document.getElementByID("form_termdate").disabled = true; } else if(action == "InActive") { document.getElementByID("form_termdate").disabled = false; } } </script> Thanks for the help! Quote Link to comment Share on other sites More sharing options...
akitchin Posted December 14, 2009 Share Posted December 14, 2009 you're passing the function an object (the radio button element), but you can't compare the object directly to the value you're expecting. you have to use the value property: if(action.value == "Active") give that a whirl. Quote Link to comment Share on other sites More sharing options...
iPixel Posted December 14, 2009 Author Share Posted December 14, 2009 That's a no go. Quote Link to comment Share on other sites More sharing options...
akitchin Posted December 15, 2009 Share Posted December 15, 2009 okay.... are you getting any error messages? have you checked the javascript error console in firefox? it could be that it's tripping on the first if() as well, where you check the object itself against a value, rather than the object's value property. 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.