Within this form, I have 2 radio buttons:
<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>
The checkForm function includes code to verify if the Disallow button is selected. If it is, an alert instructs the user to select Allow, otherwise, it returns true.
However, I noticed that even after changing my selection from Disallow to Allow, the alert remains prompting me to choose Allow.
Below 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 suggestions or solutions would be greatly appreciated.