The code below is for a checkbox, in a form on an asp page. I want to make it mandatory for the user to click it. The other validation statements work fine, this one causes a problem though.
The browser returns a debug error, i don't get the validation javascript alert below, instead the browser says:
error: document.frm.op t15. is null or not an object
and invites me to debug.
when i debug it points to the below code, i wonder what is wrong with it? the validation does go through, it's just that i don't get the alert, but on the server validation, it shows that it goes through
this is the form tag,
and this is the part of the form where the input is entered. I might add, it draws data from the database for sarrNAME
any help appreciated. Thanks in advance. Below is some code for the rest of the script, just so you can see how it is coded
The browser returns a debug error, i don't get the validation javascript alert below, instead the browser says:
error: document.frm.op t15. is null or not an object
and invites me to debug.
when i debug it points to the below code, i wonder what is wrong with it? the validation does go through, it's just that i don't get the alert, but on the server validation, it shows that it goes through
Code:
var checkbox = document.frm.opt15;
if(checkbox.checked == false) {
alert("I agree to abide by the terms of use.");
return false; }
Code:
<form action="register.asp" method="post" name="frm" onSubmit="return ValidateUser();">
and this is the part of the form where the input is entered. I might add, it draws data from the database for sarrNAME
Code:
<td><span style="color: #FF0000"><%=sarrNAME(14)%>:</span></td>
<td><input style="width: 100%;" type="checkbox" name="opt15" value="" size="40" maxlength="50" class="textbox" /></td>
Code:
if(document.frm.name.value.length > 30) {
alert("Maximum 30 characters allowed for 'name'.")
document.frm.name.focus() ;
return false; }
Comment