Jason & Juli Cook said:
Quote:
function validateForm(myForm){
if (myForm.firstname.value==""||myForm.firstname.valu e==null){
alert("fix the firstname");
myForm.firstname.focus();
return(false);
}
alert("finished Name");
return validateDate(myForm.FirstDate);
alert("finished first date");
return validateDate(myForm.SecondDate);
alert("finished second date");
} |
Imagine a friend sends his young child to you to ask you to check
some facts. You tell the child to return with the message that
the facts are correct. If you then check something else and try
to tell the child to return with the results of that, too, you'll
find that you're talking to yourself, because the child left the
first time you told him to return.
Return means "return". Now. Anything a function says to do after
a return statement is just talking to itself.
You might get what you want with:
return(validateDate(myForm.FirstDate)&&validateDat e(myForm.SecondDate));
That will run the first check and, if it is true, will also run the
second check, and if they're both true, will return "true". If either
check is false, the function will return "false".
Note that it won't make it clear to the user which date was wrong.