This Validation will not work. I put some alerts in and have noticed that when I put document.contact.sname.value the alert says undefined. Here is the code thank you.
<form method = “post” name = “contact” onsubmit = “return(checkForm());” action = “<% =home %>mail/contact.asp”>
<table width = “385” cellspacing = “0” cellpadding = “0” align = “left”>
<tr>
<td width = “30%” class = “notCenter”>Name:</td>
<td width = “70%” class = “notCenter”><input type = “text” name = “sname” size = “25”></td></tr>
<tr>
<td width = “30%” class = “notCenter”>Email:</td>
<td width = “70%” class = “notCenter”><input type = “text” name = “semail” size = “25”></td></tr>
<tr>
<td width = “30%” class = “notCenter”>Company:</td>
<td width = “70%” class = “notCenter”><input type = “text” name = “scompany” size = “25”></td></tr>
<tr>
<td width = “30%” class = “notCenter”>Send To:</td>
<td width = “70%” class = “notCenter”>
<select name = “ssend” size = “1”>
<option selected value = “Webmaster”>Webmaster</option>
<option value = “Scott Rhoads”>Commercial Department</option>
<option value = “John Hayden”>Design & Build Department</option>
<option value = “Eric Stickler”>Residential Department</option>
<option value = “Jim Brewster”>Service Department</option>
<option value = “Tom Schauer”>ATC Department</option>
<option value = “Bob Froelich”>Sheet Metal Department</option>
</select></td></tr>
<tr>
<td width = “30%” class = “notCenter”>Subject:</td>
<td width = “70%” class = “notCenter”><input type = “text” name = “ssubject” size = “25”></td></tr>
<tr>
<td width = “30%” class = “notCenter”>Message:</td>
<td width = “70%” class = “notCenter”><textarea name = “smessage” cols = “19” rows = “4”></textarea></td></tr>
<tr>
<td width = “30%”> </td>
<td width = “70$”> </td></tr>
<tr>
<td colspan = “2”><input type = “submit” name = “Submit” value = “Submit”> <input type = “reset” name = “resetIt” value = “Reset”></td></tr>
</table></form>
<script language = “javascript”>
function checkForm()
{
alert(document.contact.sname.value);
if (document.contact.sname.value == “”)
{
alert(“Enter Your Name”);
document.contact.sname.focus();
return false;
}
if (document.contact.semail.value == “”)
{
alert(“Enter Your Email”);
document.contact.semail.focus();
return false;
}
if (/^w+([.*@w+([..
{
}
else
{
alert(“Enter a Valid Email”);
document.contact.semail.focus();
return false;
}
if (document.contact.ssubject.value == “”)
{
alert(“Enter the Subject”);
document.contact.ssubject.focus();
return false;
}
if (document.contact.smessage.value == “”)
{
alert(“Enter a Message”);
document.contact.smessage.focus();
return false;
}
alert(“Thanks for Contacting Us”);
return true;
}