I have many functions written in JavaScript such as userName(), password() etc. But on submitting on the form, I have a single function return formValidator();.
I want function to call all the other functions and check whether they are returning false or not. If they all are true than it should return true, otherwise it should return false.
function userName(){
var x=document.forms["signupform"]["firstname"].value;
if(x=="" ||x==null){
document.getElementById("firstname").style.border="1px solid #F50A0A";
document.getElementById("firstname").style.boxShadow="2px 2px 5px #F50A0A";
return false;
}else {return true;}
}
function password(){
var z=document.forms["signupform"]["password"].value;
if(z=="" ||z==null){
document.getElementById("password").style.border="1px solid #F50A0A";
document.getElementById("password").style.boxShadow="2px 2px 5px #F50A0A";
return false;
}else {return true;}
}