Well I’ve tried more things.
The code has ended up looking like this, and
is still not working…
.. this is a continuation from:
[url]http://www.jsworkshop.com/bb/viewtopic.php?t=617
[url]http://www1.gnb.ca/0007/Culture/Heritage/VMC/mailer/sendmail-e.asp
[size=1]
function RequiredFields()
{
if( Validate() )
{
// validation passed, allow post
document.frmInfo.submit();
} // validation failed, disallow post return false;
}
function Validate()
{
//— Make sure the Name was entered
if(document.frmInfo.txtName.value.length == 0){
document.frmInfo.txtName.focus();
document.frmInfo.txtName.select();
alert(“You must enter your name to continue.”);
return false;
}
//— Make sure the EMail Address was entered
if(document.frmInfo.txtEMail.value.length == 0){
document.frmInfo.txtEMail.focus();
document.frmInfo.txtEMail.select();
alert(“You must enter an EMail address to continue.”);
return false;
}
//— Make sure the Comments are entered
if(document.frmInfo.txtComments.value.length == 0){
document.frmInfo.txtComments.focus();
document.frmInfo.txtComments.select();
alert(“You must enter your comments to continue.”);
return false;
}
return true;
}
[size=1]
<form name=”frmInfo” method=”POST” action=”mail.asp”>
<INPUT TYPE=”hidden” NAME=”txtAction” VALUE=””>
<INPUT TYPE=”button” VALUE=”Submit” name=”btnSubmit” onclick=”RequiredFields()”>