I have an online employment application I am creating for the office. In the application there are yes no questions that I have used radio buttons for. For some reason I can't get the script to focus on the radio group. Here is a simple snipet of what I am doing.
<script language="JavaScript">
function checkform() {
if (!document.form1.Gen_EighteenOrYounger.checked)
{
alert("Please select wether you are over 18 or not."
;
document.form1.Gen_EighteenOrYounger.focus();
return false;
}
}
</script>
Now, I call this function by the onSubmit in the form tag.
<FORM method="POST" action="review.asp" name="form1" onSubmit="return checkform()">
I get the alert to please select your age but then it continues on and processes the form and sends me over to the next page.
I don't get what I am missing. Is there an easier way to do this?
Thanks,
John Axsom
<script language="JavaScript">
function checkform() {
if (!document.form1.Gen_EighteenOrYounger.checked)
{
alert("Please select wether you are over 18 or not."
document.form1.Gen_EighteenOrYounger.focus();
return false;
}
}
</script>
Now, I call this function by the onSubmit in the form tag.
<FORM method="POST" action="review.asp" name="form1" onSubmit="return checkform()">
I get the alert to please select your age but then it continues on and processes the form and sends me over to the next page.
I don't get what I am missing. Is there an easier way to do this?
Thanks,
John Axsom