
February 19th, 2013, 09:24 PM
|
 |
Contributing User
|
|
|
|
Here your comparing password1 to password2; in your if condition. So if both password fields are not exactly the same, then you get the error.
Code:
password1 = document.getElementById("passwordbox").value;
password2 = document.getElementById("retypepasswordbox").value;
if (password1 != password2)
And here...
Code:
var invalidUser = document.getElementById("usernamebox").value;
if (invalidUser != "test")
{
You are checking to see if the inValidUser variable is "test"... and if it's not; then you get the error.
My advice; on how you can get around this is... do not use the "validateAccount()" function onclick (triggered by the submit button's onclick event); but, add this function to the form's onsubimt event... instead.
|