Filtrage champ de saisie clé

This commit is contained in:
Fred Tempez 2024-12-23 15:33:05 +01:00
parent 3af3dcd681
commit e0fb90d207
2 changed files with 21 additions and 3 deletions

View File

@ -13,3 +13,21 @@
*/ */
$(document).ready(function () {
$('#userAuthKey').on('input', function () {
// Récupère la valeur du champ
let input = $(this).val();
// Supprime tous les caractères non numériques
input = input.replace(/\D/g, '');
// Limite à 6 caractères maximum
if (input.length > 6) {
input = input.substring(0, 6);
}
// Met à jour la valeur du champ
$(this).val(input);
});
});

View File

@ -13,10 +13,10 @@
'value' => template::ico('left') 'value' => template::ico('left')
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8" id="loginContainer"> <div class="col3 offset7" id="loginContainer">
<?php echo template::submit('userLoginSubmit', [ <?php echo template::submit('userLoginSubmit', [
'value' => template::ico('check'), 'value' => 'Connexion',
'ico' => '', 'ico' => ''
]); ?> ]); ?>
</div> </div>
</div> </div>