MBhalli Posted April 7, 2017 Report Share Posted April 7, 2017 How can I invoke an "onclick" event for a radio button of two choices Yes or No. <script type= "text/javascript"> function ValueChanged() { alert("Function Called"); if(document.getElementById("InsertRecordMetalic_Injury")[1].checked == true;){ document.getElementById("InsertRecordPrior_Surgery")[1].style.background = "yellow"; } document.getElementById("InsertRecordPhone").focus(); } document.getElementById("InsertRecordPrior_Surgery")[1].onclick= ValueChanged; </script> Quote Link to comment Share on other sites More sharing options...
MayMusic Posted April 10, 2017 Report Share Posted April 10, 2017 The ID of a radio button does not seem to be correct. Refer to It should be something like, InsertRecordMetalic_Injury0, InsertRecordMetalic_Injury1 .... Also you do not need == true <script type= "text/javascript"> function ValueChanged() { alert("Function Called"); if(document.getElementById("InsertRecordMetalic_Injury0").checked){ document.getElementById("InsertRecordPrior_Surgery0")0.style.background = "yellow"; } document.getElementById("InsertRecordPhone").focus(); } document.getElementById("InsertRecordPrior_Surgery0").onclick= ValueChanged; </script> But I am not sure how to change the background color MBhalli 1 Quote Link to comment Share on other sites More sharing options...
MBhalli Posted April 11, 2017 Author Report Share Posted April 11, 2017 Thank you so much for directing me to the "Caspio form element" Page. I'm not able to change the background color of a radio button, but I have added some animation to reflect a radio button click event. Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 30, 2017 Report Share Posted June 30, 2017 Sounds good. Please share the workaround with us if you do not mind 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.
Note: Your post will require moderator approval before it will be visible.