I am trying to return false if no radio button has been selected using the following script:
function validatefilling(){ var a=document.getElementById("myfilling"); if (fillingselected == 0){ var resultloc=document.getElementById("fillingerror"); resultloc.innerHTML = "<span style='color:red;'>Please select a filling!<span>"; return false; } var resultloc=document.getElementById("fillingerror"); resultloc.innerHTML = ""; return true; } It doesn't seem to work however. I am trying to have the message "Please select a filling!" appear if nothing has been selected after the user submits the form. "fillingselected" is the value of the radio form submitted.