Formulaires

Input Mask Form


<script src="https://cdnjs.cloudflare.com/ajax/libs/inputmask/4.0.9/jquery.inputmask.bundle.min.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#code_postal").inputmask("99999");
$("#birthday").inputmask("9999");
$('#T-l-phone-3').inputmask("99 99 99 99 99");
$("#code_postal").keyup(function(event) {
?if (event.keyCode == 13) {
?event.preventDefault();
??document.getElementById("btn_first_step").click();
}
})
$("#birthday").keyup(function(event) {
?if (event.keyCode == 13) {
?event.preventDefault();
??document.getElementById("btn_step_two").click();
}
})
$("#btn_first_step").click(function(e) {
var pattern = /^\d+$/;
var code_postal = $('#code_postal').val();
if (code_postal.length == 5 && pattern.test(code_postal) ) {
$('#error_postal').remove();
$('#code_postal').css('border-color', '#80C8EA')
??return true;
} else {
$('#code_postal').css('border-color', 'red')
$('<span style="color:red;font-size:12px" id="error_postal">votre code postal n\'est pas correct</span>').insertAfter($('#code_postal'))
? return false;
} ?
});
$('#btn_step_two').click(function(){
var pattern = /^\d+$/;
var birthday = $('#birthday').val();
if (birthday.length == 4 && pattern.test(birthday)) {
if (birthday > 1900 && birthday < 2005) {
?$('#error_birthday').remove();
$('#birthday').css('border-color', '#80C8EA')
return true;
} else {
$('#error_birthday').remove();
$('<span style="color:red;font-size:12px" id="error_birthday">votre date de naissannce doit être compris entre 1900 et 2005</span>').insertAfter($('#birthday'))
?return false;
}
} else {
$('#birthday').css('border-color', 'red')
$('<span style="color:red;font-size:12px" id="error_birthday">votre date de naissannce n\'est pas correct</span>').insertAfter($('#birthday'))
? return false;
} ?
})
})
</script>
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.