Email valiadation script-HELP

wxdqz

New Member
I am trying to check for errors in the email address users enter for a forgotten password facility. I need to ensure that a ' (apostrophe) is not entered as it goes to an error page.

I have the following JavaScript embedded into the code but it doesnt work.

<html>
<head>
<title>ECDL Preparation Kit</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Page-Enter" content="revealTrans(Duration=3.0,Transition=3)">

<script LANGUAGE="JavaScript">

function valForm(obj_dform) {
missinginfo = "";
if (document.dform.Email.value == "") {
missinginfo += "\n - Email";
}
if (missinginfo != "") {
missinginfo ="You failed to fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(dform.Email.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)

}
}

</script>
</head>

<body bgcolor="#CCCCCC" text="#000000">
<form onSubmit="return valForm(dform)" name="dform" method="POST" ACTION="Sendpassword.asp">

<input type="hidden" name="action" value=http://www.webdeveloper.com/forum/archive/index.php/"Send email">
<div align="center"></div>
<table width="75%" border="1" bgcolor="#FFFFFF" bordercolor="#FFFFFF" align="center">
<tr>
<td bgcolor="#FFFFFF" height="95"><img src="head2.jpg" width="851" height="96"></td>
</tr>
<tr>
<td height="477" bgcolor="#FFFFFF" valign="top">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center"><font color="#FFFFFF" size="5"><b><font color="#990000" face="Bookman Old Style" size="6">Forgotten
Username and Password ?</font></b></font></p>
<p align="center"><img src="penemail.gif" width="141" height="85"></p>
<p align="center"><font color="#990000"><font color="#000000" size="4">Please
enter you email address below and they will be sent to you immediately</font></font></p>
<p>&nbsp;</p>


<div align="center">
<p><font color="#FFFFFF"><b><font color="#000000" size="4">Email Address:</font>
</b></font><!--webbot bot="Validation" startspan
B-Value-Required="TRUE" I-Minimum-Length="1" --><!--webbot bot="Validation" endspan -->
<input type="test" name="Email" value=Email size="30">
</p>
<p>
<input type="Submit" name="Submit" value="Submit ">
</p>
</div>

</td>
</tr>
</table>
<div align="center"></div>
</form>
</body>
</html>


any ideas where I am going wrong ? Please help
 
Back
Top