Jump to content

help - validation


astralaaron

Recommended Posts

does anyone know why when this returns false it still loads the next website?on my form i used onsubmit="validate();"

function validate() {var theMessage = "The following errors occured: \n-----------------------------------\n";var noErrors = theMessage;if (document.adduser.nm.value == "Account Name") {theMessage = theMessage + "\n --> You must enter a User Name";}if (document.adduser.pw1.value == "Account Password" || document.adduser.pw2.value == "Repeat Password") {theMessage = theMessage + "\n --> You must enter and repeat a password";}if (document.adduser.pw1.value != document.adduser.pw2.value) {theMessage = theMessage + "\n --> Password fields do not match";}if (theMessage == noErrors) {return true;} else {alert(theMessage);return false;}}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...