[thelist] Submitting two validation scripts

Ken Snyder ksnyder at coremr.com
Mon Apr 2 10:07:47 CDT 2007

Pamela Corey wrote:
> This is probably an easy one.  I have two validation scripts for a 
> page and I want to put them both in one form onSubmit tag.  What is 
> the correct code?  I thought it was:
> onsubmit="return validateForm(this,arrFormValidation); && return 
> ValidateFormDate();"
> but that isn't working.
> Can someone refresh my brain?  I've also tried it without the first ; 
> but that doesn't work either.
> Thanks,
> Pam
> Pamela Corey
> IT Specialist
> Public and Business Affairs Office
> National Institute of Standards and Technology (NIST)
> 301-975-2170  
Try without the semicolon and without the return.

onsubmit="return validateForm(this,arrFormValidation) && ValidateFormDate();"

A compound statement like this will return true only if both items are true.  Consider these examples:

return true && true;  // returns true
return false && whatever; // parser doesn't even evaluate "whatever", it just returns false.

--Ken Snyder

More information about the thelist mailing list