I am working on a project and need to do some client side validation.
I am doing all validations by calling the onsubmit() method.
The problem that I am facing is that the validation runs just fine when I put into comments a few other statements but not otherwise.
My code:
var speak1=document.forms["form"]["speak1"].value
b = checkSpeakLanguages(speak1);
if(b==false){
return false;
}
which calls checkSpeakLanguage works properly.
But the following code works only when the above is put in comments:
var m= document.forms["form"]["maritalStatus"].value
b = checkMaritalStatus(m);
if(b==false){
return false;
}
Please help me. Please tell me why both the second part does not work when the other is present.
If the first
breturns false, you return before the second part can execute. Combine the functions for your submit handler to something like: