still trying to validate (i suck)

wxdqz

New Member
Well I've tried more things.
The code has ended up looking like this, and
is still not working...

.. this is a continuation from:
<!-- m --><a class="postlink" href="http://www.jsworkshop.com/bb/viewtopic.php?t=617">http://www.jsworkshop.com/bb/viewtopic.php?t=617</a><!-- m -->

****************************
<!-- m --><a class="postlink" href="http://www1.gnb.ca/0007/Culture/Heritage/VMC/mailer/sendmail-e.asp">http://www1.gnb.ca/0007/Culture/Heritag ... mail-e.asp</a><!-- m -->
****************************


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;
}

***********************************

<form name="frmInfo" method="POST" action="mail.asp">
<INPUT TYPE="hidden" NAME="txtAction" VALUE=http://www.webdeveloper.com/forum/archive/index.php/"">

<INPUT TYPE="button" VALUE="Submit" name="btnSubmit" onclick="RequiredFields()">
***********************************
 
Back
Top