enter key simulated submit form

This commit is contained in:
2019-08-26 11:58:11 +02:00
parent e503586e61
commit 8f2e76cbfa
4 changed files with 57 additions and 43 deletions

View File

@@ -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>
&nbsp;&nbsp;
</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>

View File

@@ -25,23 +25,12 @@
<label class="col-sm-4 control-label">Nom ou numéro du chantier</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="name" value="${name}"
data-fv-notempty="true"
data-fv-notempty-message="Le nom ou le numéro est obligatoire"
data-fv-stringlength="true"
data-fv-stringlength-min="2"
data-fv-stringlength-max="30"
data-fv-stringlength-message="Le nom ou le numéro doit avoir de 2 à 30 caractères de long" />
</div>
</div>
<!-- case a cocher "Afficher fiches cloturées" -->
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<input type="checkbox" name="cb_tous" value="cb_tous"
tal:attributes="checked cb_tous == 'oui' and 'checked' or None">
Afficher les chantiers cloturées</input>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
@@ -74,6 +63,7 @@
<script type="text/javascript">
var dataSet = ${dt_data};
var goto_url = '${goto_url}';
var order_option = '${order_option}'
$(document).ready(function() {
$.fn.dataTable.moment('DD-MM-YYYY');
@@ -84,6 +74,7 @@
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
},
order: [[0, order_option]],
columnDefs: [
{ "targets": 0,
"render": function (data, type, full, meta) {