enter key simulated submit form
This commit is contained in:
@@ -8,31 +8,21 @@
|
||||
<br />
|
||||
<div class="col-md-offset-4 col-md-4 well">
|
||||
|
||||
<form id="login-form" role="form" action="${url}" method="post"
|
||||
data-fv-framework="bootstrap"
|
||||
data-fv-icon-valid="glyphicon glyphicon-ok"
|
||||
data-fv-icon-invalid="glyphicon glyphicon-remove"
|
||||
data-fv-icon-validating="glyphicon glyphicon-refresh">
|
||||
<form id="login-form" role="form" action="${url}" method="post" >
|
||||
|
||||
<h3>Se connecter</h3>
|
||||
<input type="hidden" name="came_from" value="${came_from}"/>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" name="login" value="${login}"
|
||||
placeholder="Identifiant"
|
||||
data-fv-notempty="true"
|
||||
data-fv-notempty-message="L'identifiant est obligatoire" />
|
||||
<input class="form-control" type="text" name="login" value="${login}" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="password" name="password" value=""
|
||||
placeholder="Mot de passe"
|
||||
data-fv-notempty="true"
|
||||
data-fv-notempty-message="Le mot de passe est obligatoire">
|
||||
<input class="form-control" type="password" name="password" value="" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary" type="submit" name="form.submitted">Se connecter</button>
|
||||
<button id="submitButton" class="btn btn-primary" type="submit" name="form.submitted">Se connecter</button>
|
||||
|
||||
</div>
|
||||
<p class="help-block">
|
||||
@@ -49,9 +39,38 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#login-form').formValidation();
|
||||
$('#login-form').formValidation({
|
||||
framework: 'bootstrap',
|
||||
message: 'This value is not valid',
|
||||
icon: {
|
||||
valid: 'glyphicon glyphicon-ok',
|
||||
invalid: 'glyphicon glyphicon-remove',
|
||||
validating: 'glyphicon glyphicon-refresh'
|
||||
},
|
||||
fields: {
|
||||
login: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Le code utilisateur est obligatoire'
|
||||
},
|
||||
}
|
||||
},
|
||||
password: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Le mot de passe est obligatoire'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$('form input').on('keypress', function(e) {
|
||||
return e.which !== 13;
|
||||
var code = e.keyCode || e.which;
|
||||
if (code === 13) {
|
||||
e.preventDefault();
|
||||
// simuler clic bouton submit
|
||||
document.getElementById("submitButton").click();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user