Corrected javascript verification of the form
This commit is contained in:
parent
86b3b1733b
commit
a03dc89195
|
@ -34,8 +34,9 @@ block content
|
||||||
alert('Select a correct date for the last time you played please');
|
alert('Select a correct date for the last time you played please');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
form#form.form-signin(method="POST", action='/identification', onsubmit='return validateForm()')
|
form#form.form-signin(method="POST", action='/identification')
|
||||||
h2 Please sign in
|
h2 Please sign in
|
||||||
label(for='inputId').sr-only Id
|
label(for='inputId').sr-only Id
|
||||||
input#inputId.form-control(name="inputId", type="text", placeholder='Id', required, autofocus)
|
input#inputId.form-control(name="inputId", type="text", placeholder='Id', required, autofocus)
|
||||||
|
@ -92,7 +93,13 @@ block content
|
||||||
|
|
||||||
button#submitButton.btn.btn-lg.btn-primary.btn-block(type='submit') Sign in
|
button#submitButton.btn.btn-lg.btn-primary.btn-block(type='submit') Sign in
|
||||||
script.
|
script.
|
||||||
document.getElementById('submitButton').onclick = function() {
|
document.getElementById('submitButton').onclick = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
document.getElementById('submitButton').disabled = true;
|
document.getElementById('submitButton').disabled = true;
|
||||||
document.getElementById('form').submit();
|
if (validateForm()) {
|
||||||
|
console.log("Ok");
|
||||||
|
document.getElementById('form').submit();
|
||||||
|
} else {
|
||||||
|
document.getElementById('submitButton').disabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue