I've got 2 radio buttons within a form here,
<form action='' method='post' onsubmit='return checkForm(this, event)'>
<input type = 'radio' name='allow' value='allow' checked>Allow
<input type='radio' name='allow' value='disallow'>Disallow
</form>
And in the checkForm function, there is a piece of code to verify whether the user checks the Disallow button, if yes, show an alert to force the user to allow, if not, return true.
Yet, I found that when I first checked the Disallow button, and the sign showed, and then I change it to Allow, but there is still the alert sign popping saying that I should alter my choice to Allow
This is the checkForm function:
<script type="text/javascript">
function checkForm(form, event) {
var radio = document.getElementsByName("allow");
var counter=0;
for(i=0;i<radio.length;i++){
if(radio[i].value=="disallow"){
alert("Please allow the system to get your data!");
return false;
}
}
return true;
}
</script>
Any ideas? Thanks a lot.