JOKER_JOKER
Limp Gawd
- Joined
- Nov 2, 2005
- Messages
- 471
I am working on a registration form for my website and I got it to output the errors in their registration form as they are typing using javascript and ajax (such as a username already being used or password too short), but I'm not sure how to make it so they can't submit the form unless they correct these errors.
HTML code:
Each of the javascript functions take the arguments from the form and see if they meet specifications, however, I'm not sure how to make it so they can't submit the form unless they handle the errors. I tried using a function that calls the other smaller functions when the user submits the form but that doesn't seem to work. I can show the javascript code if you need. Any ideas?
HTML code:
Code:
<form name=registrationForm action="insert.php" method="post" onsubmit="return isFormValid(this)">
<br />
Desired Username:
<input type="text" name="usernameField" onkeyup="showUser(this.value)" />
<div id="userTaken"></div>
<br />
Desired Password:
<input type="password" name="passField1" onkeyup="passLength(this.value)" />
<div id="passLength"></div>
<br />
Retype Password:
<input type="password" name="passField2" onkeyup="areEqual(this.value, passField1.value)" />
<div id="passEqual"></div>
<br />
Email Address:
<input type="text" name="emailField" onkeyup="isEmailValid(this.value)" />
<div id="emailValid"></div>
<br />
<input type="submit" value="Register" />
</form>
<div id="formValid"></div>