Open gh59291 opened 6 years ago
0) useful & powerful library, thx 4 work.
i) i want to check age range from server with $.post action.
ii) Problem : a) if first test is false -wrong date b) and second test is good, c) validator does not reset / perfome test and let form submit
In facts it seems that validation is not processed anymore. Should i reset form validation before ?
iii) addValidator(s) :
-this works fine-
$.formUtils.addValidator({ name : 'checkDateBirthHolderJs', validatorFunction : function(value, $el, config, language, $form) { var age=ageGet(value,'/'); console.log('checkDateBirthHolder='+age); var check=true; if(parseInt(age)<16){ check=false }; if(parseInt(age)>45){ check=false }; return check; }, errorMessage : gloss.badBirthHolder, errorMessageKey: 'badBirthHolder' });
this returns good ajax response but no "re-validation"
$.formUtils.addValidator({ name : 'checkDateBirthHolderAjax', validatorFunction : function(value, $el, config, language, $form) { var csrf=$form.find('#csrf').val(); var check=false; $.post( "/myController/dataCheck/", { csrf:csrf, date_birth:value, ac:'date_birth_holder', i18n:app.i18n }, function(rsp,status) { //console.log(rsp); var data = $.parseJSON(rsp); console.log(data); console.log(check); check=data.valid; console.log(check); //check ok return check; }); return check; }, errorMessage : gloss.badBirthHolder, errorMessageKey: 'badBirthHolder' });
iv) using server leads to same problem.
What's wrong ? Thx for tips & time gh59291
0) useful & powerful library, thx 4 work.
i) i want to check age range from server with $.post action.
ii) Problem : a) if first test is false -wrong date b) and second test is good, c) validator does not reset / perfome test and let form submit
In facts it seems that validation is not processed anymore. Should i reset form validation before ?
iii) addValidator(s) :
-this works fine-
this returns good ajax response but no "re-validation"
iv) using server leads to same problem.
What's wrong ? Thx for tips & time gh59291