New to javascript but I have a good analytical mind....that being said, I have the following code in onSubmit() validation:
else if (cofaCOURRIEL == null || cofaCOURRIEL == "") {
alert('Le champ COURRIEL doit être rempli.');
document.forms["COFA_AIG"] ["COURRIEL"].focus();
return false;
}
else if (cofaCOURRIEL) {
if ( (atPOS < 1) || (dotPOS < atPOS + 2) || ((dotpos + 2) >= cofaCOURRIEL.length) ) {
alert('Adresse de courriel invalide.');
document.forms["COFA_AIG"] ["COURRIEL"].focus();
return false;
}
}
else if (cofaDATE == null || cofaDATE == "") {
alert('Le champ DATE doit être rempli.');
document.forms["COFA_AIG"] ["DATE"].focus();
return false;
}
I understand it is not the best way to validate client side, but I will be doing php server side validation as well.
My problem is that once the variable "cofaCOURRIEL" is valid, the script stops and returns true....not sure why...I'm guessing I'm missing an "else" statement after the embedded "if" statement, but I'm only guessing and if I'm correct, I wouldn't know what to put in the else statement to let it not break out of the validation...
any input?
Thanks!