I have a basic signup form:
<form action="adduser" method="post" onsubmit='passwordCheck()'>
Email Address: <input type="email" name="email" required autocomplete="on" placeholder="fr@star.com"/><br/>
Username: <input type="text" name="username" maxlength=25 required placeholder="JoyfulSophia"/><br/>
Password: <input type="password" name="password" id='password' onkeydown='checkPassword()' maxlength=30 required placeholder="**********" />
Password (Again): <input type='password' id='pass_repeat'/>
<br/>
<br/>
<input type="submit" value="Send" /> <input type="reset">
</form>
So when the form is submitted, it calls passwordCheck(), which tests it against easily guessable passwords, not repeating the same password etc. It puts the error, if any, in a <p>
(not shown). checkPassword() works and the error is displaying correctly, but the form still submits while JS docs that I've read say that if onsubmit returns false, the form should not submit.
Why is the form submitting when checkPassword() returns false? Also, checkPassword() is not being called on each keystroke in the passwords input.