I'm trying to validate attachment field, below code is working but when i use async false
attachment:{
required:{
depends: function () {
var res=false;
$.ajax({
type: "POST",
url: baseUrl+"status",
async: false,
cache: false,
dataType: "json",
success: function (result) { res=result; }
});
return res;
}
}
this function is called two times but when i remove async:false then validation is not working because res value is returned before the ajax call is executed.
Any solution. Thanks
ajaxinside of adependsinside ofrequired; nor was it explained why getting called multiple times is a problem. Where is the relevant HTML and the description about what you are trying to validate with this arrangement? Is there a reason why this cannot be done with theremotemethod instead?dependsis used for. Your field isrequireddepending on some condition. Example: a text field is onlyrequiredwhen a checkbox is checked. What purpose is being served by the ajax here?trueorfalsebased on value return from server that's why i called ajax can you please provide some link for the sameremotemethod.