As common trick in JS form validation :
function validate(){
if(test != expected_value){
....;
....;
alert("something went wrong");
return false;
}
_________
be careful about 'submit' use..
if your form already have a submit button, the form will be send twice. weird thing after that.
---------
length need a comparison with integer .. you test a metric, but call for boolean, Js is low type, sure the 0|false will pass but be careful.
write it in plenty word :
if(myarray.length == 0){...;}
_________
as global advice, write your code again,
by embeding all tests , you made a 'confusing' validation script.
take at :
step 1 : what to do. what is the code needed ?
step 2 : what to do. what is the code needed ?
step 3 : what to do. and so and so..
review your global code pattern :)