// JavaScript Document function checkDetails(MyForm){ var name = MyForm.Name.value var email = MyForm.Email.value var allError = 'These following errors were encountered during the submission process:\n\n' var errorFound = 0 if(name == ''){ allError += '- Your name was not correctly entered\n' errorFound++ } // Email address validation var at var dot = 0 var loc_at var loc_dot var validEmail = 0 for(i=0;i= 1 && i != (loc_at+1) && i != (loc_dot+1)){ validEmail = 2 loc_dot = i } if(at == '.'){ // counting number of dots. dot++ if(i == (loc_dot+1)){validEmail = 1} } } if(email.charAt(email.length-1) == '.'){ validEmail = 1 } if(validEmail < 2 || dot > 2){ allError += '- Email was not correctly entered\n' errorFound++ } if(errorFound > 0){ alert(allError+'\nYou must complete the form before continuing the submission process.\n') return false } else{ return true } }