When submitting a new user, an error message is appearing;
A Runtime Error has occured.
Do you wish to Debug
Line:67
Error:'document.frmUser.txtUser.txtPassword' is a null or not an object
Line 67 is onSubmit="return VerifyData();">
Can anyone help with this problem?
Thanks in advance
A Runtime Error has occured.
Do you wish to Debug
Line:67
Error:'document.frmUser.txtUser.txtPassword' is a null or not an object
Line 67 is onSubmit="return VerifyData();">
Can anyone help with this problem?
Thanks in advance
Code:
<!--#include file ="clock.inc"-->
<SCRIPT language="JavaScript">
<!--
function formValidateEmail(email) {
var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
return regex.test(email);
}
function VerifyFields() {
var msg="The following fields appear to be invalid:";
var blank=false;
for(var x=0;x<document.forms[0].length;x++) {
theObj=document.forms[0].elements[x];
theType=theObj.type;
theName=theObj.name;
theValue=theObj.value;
if((theType!="SUBMIT")&&(theType!="RESET")) {
// check if the field is the Email address and validate
if((theName=="txtEmailAddress")&&(!formValidateEmail(theValue))) {
msg+="\n* "+theName.substring(3,theName.length);
blank=true;
}
// check the other fields but ignore txtAddress2
if((theName!="txtAddress2")&&(theValue=="")) {
msg+="\n* "+theName.substring(3,theName.length);
blank=true;
}
}
}
if(blank) {
alert(msg);
return false;
}
return true;
}
function VerifyData() {
if (VerifyFields()) {
if (document.frmUser.txtPassword.value != document.frmUser.txtVerifyPassword.value) {
alert ("Your passwords do not match - please reenter");
return false;
} else return true;
} else return false;
}
//-->
</SCRIPT>
<div id="content">
<font face="Arial">
<input type="button" onClick="document.all.content.style.zoom=(document.all.content.style.zoom==1?2:1);" value="Change Font Size">
<title>UK Heart Trust Registration Form</title>
</head>
<body style="font-family: arial">
<body bgcolor="#99CCFF">
<body onload="StartClock()" onunload="KillClock()">
</font>
<form name="theClock" action="adduser.asp" METHOD="post" onSubmit="return VerifyData();">
<font face="Arial">
<input type="text" name="theTime" size=6><% Response.Write Date %><br>
<font face="Arial">
<title>UK Heart Trust Registration Form</title>
</head>
<body style="font-family: arial">
<body bgcolor="#99CCFF">
</font>
<form action="adduser.asp" METHOD="post" >
<H1 align="center"><u>Registration Form</u></H1>
Title: <SELECT NAME="txtTitle">
<OPTION value="mr">Mr</OPTION>
<OPTION value="mrs">Mrs</OPTION>
<OPTION value="miss">Miss</OPTION>
<OPTION value="ms">Ms</OPTION>
<OPTION value="master">Master</OPTION>
<OPTION value="doctor">Doctor</OPTION>
<OPTION value="lord">Lord</OPTION>
<OPTION value="sir">Sir</OPTION>
</SELECT><BR>
First Name: <input type="text" name="txtFirstName" size="20" ><br>
Surname: <input type="text" name= "txtSurname" size="20" ><br>
Address1: <input type="text" name="txtAddress1" size="20"><br>
Address2: <input type="text" name="txtAddress2" size="20"><br>
Town: <input type="text" name="txtTown" size="20"><br>
County: <input type="text" name="txtCounty" size="20" ><br>
Post Code: <input type="text" name="txtPostCode" size="20" ><br>
Telephone Number: <input type="text" name="txtTelephoneNo" size="20" ><br>
Email Address: <input type="text" name="txtEmailAddress" size="20" ><br>
<h3>Login Details</h3>
Username: <input type="text" name="txtUsername" size="20"><br>
Password: <input type="password" name="txtPassword" size="20"><br>
Verify Password: <input type="password" name="txtVerifyPassword" size="20"><br>
Secret Question: <input type="text" name="txtSecretQuestion" size="20">
(this is required to remind you of your password just incase you forget it)<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit"> <INPUT TYPE="RESET" VALUE="Clear">
</form>
<p>
</font>
<font face="Comic Sans MS"><i>Registered Charity - 00006257</i></font></p>
<% set pageCount = Server.CreateObject("MSWC.PageCounter") %>
<p>
<font face="Comic Sans MS">This page has been accessed <%= pageCount.pageHit %> times.</font><font face="Arial">
</div>
</font>
</body>
</html>