I am slightly new to javascript and I'm starting to understand how this coding mechanism works. I created a simple html form with a number of fields. I am using javascript to acquire the data from the field and validate it through a number of validation functions. The following code is the javascript I'm currently using:
function Validation()
{
submit_name = document.getElementById('txt_Name').value;
submit_surname = document.getElementById('txt_Surname').value;
submit_mobilenumber = document.getElementById('MobileNumber').value;
if(checkName(submit_name))
{
if(checkSurname(submit_surname))
{
if(checkMobile(submit_mobilenumber))
{
}
}
}
return false;
}
My question is this: In the case of this code, the main function(Validation()) will traverse all the individual functions one by one?
If for example the checkName() function returns false, will the other two validation functions checkSurname() and checkMobile() run or will the program stop at the first one?
The reason for my question is that after all the validation functions have returned through I want to add another function to save everything to a file. However this should only be done when all the forms have been validated. Any help is much appreciated thanks in advance.