Below i modified your script and now it check for null value.
<html>
<head>
<script language="JavaScript" type="text/javascript">
function verify ( form )
{
if (form.email.value == "") {
alert( "Please enter your email address." );
return false ;
}
else {
return true ;
}
}
</script>
</head>
<body>
<form method="post" name="Comment Form" action="PHP/comment.php" target="_self" onsubmit="return verify(this)">
<table border="0" name="pageid" id="commentform">
<tr>
<td><div align="right">Email: (Required)</div></td>
<td><input type="text" name="email" size="30" /></td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</td>
</tr>
</table>
</form>
</body>
</html> You have to callverify function on onSubmit event of form.
You can also use php validation for null value checking and email validation.
-keval
keval_hack
Junior Poster in Training
Banned
66 posts since Jan 2010
Reputation Points: 8
Solved Threads: 4