On a webpage I have a form:
<form action="/SignUp.py" method="post">
<input required type="text" name="fullName" onKeyPress="checkFinished()" autofocus>
<input type="submit" name="submitButton" value="Sign Up" disabled>
</form>
and script:
<script>
function checkFinished() {
if (document.getElementsByName("fullName")[0].value.match(/. ./).length > 0) {
document.getElementsByName("submitButton")[0].disabled = false;
}
else {
document.getElementsByName("submitButton")[0].disabled = true;
}
}
</script>
If I step through the code using Firebug, I can see the execution path is correct. However, when the code hits the else clause and should be (re-)disabling submitButton
, it does not get disabled. What am I doing wrong here?