var $frmIBIS, $CA; $(function () { $CA = $('#CA'); $frmIBIS = $('#frmIBIS'); let $CA_NextStep = $('#VCA'); const regex = new RegExp($('#CA')[0].pattern); $CA.on('keypress', function(e){ let code = e.keyCode || e.which; if(code === 13) { e.preventDefault(); $CA_NextStep.click(); } }); $('#VCA').click(function(e){ e.preventDefault(); if (!$CA.val()) { // N° IBIS non renseigné eni.msg({ Class: 'Alert CA', Title: '', Content: $frmIBIS.data('empty') + '

' + $frmIBIS.data('additional'), Btns: [ {Title : $frmIBIS.data('choice2'), fn: function(){$(this).closest('.dlgContent').find('.dlgBtnClose').click();NextStep(false);}}, {Title : $frmIBIS.data('choice1'), fn: function(){$(this).closest('.dlgContent').find('.dlgBtnClose').click();$CA.focus();}} ] }); } else if (!regex.test($CA.val())) { // Format invalide Invalid(); } else { // N° IBIS non valide let _form={}; _form['cl'] = eni.lng.code(); _form['ca'] = $CA.val(); eni.axc({Async:true,Type:'script', Url:'./actiris/ajax/authA.aspx', Data:_form, Msg:job_in_progress}); } return false; }); }); // code invalide Invalid = function(){ valid=false; eni.msg({ Class: 'Alert CA', Title: '', Content: $frmIBIS.data('error') + '

' + $frmIBIS.data('additional'), Btns: [ {Title : $frmIBIS.data('choice2'), fn: function(){$(this).closest('.dlgContent').find('.dlgBtnClose').click();NextStep(false);}}, {Title : $frmIBIS.data('choice1'), fn: function(){$(this).closest('.dlgContent').find('.dlgBtnClose').click();$CA.focus();}} ] }); } // passage étape suivante NextStep = function(valid){ // on masque l'étape en cours $CA.parent().parent().hide(); if (!valid) {$CA.val("");} // en fonction du statut on affiche l'étape suivante $('#INSCRIPTION_CP > .container').show(); $('#CP').focus(); }