Hi,Is possible to make validation of input in create form with ajax call ? I have this code but I am not able to make that return function wait for AJAX response.
Alfresco.forms.validation.checkNumber = function checkNumber(field, args, event, form, silent, message) {
//get actual value
var billYear = field.value;
var scriptURL = Alfresco.constants.PROXY_URI + "someco/Exists.json?billYear=" + billYear;
var valid = false;
// check if exists
Alfresco.util.Ajax.jsonGet({
url: scriptURL,
scope: this,
successCallback: {
fn: function handleInfo(obj) {
if(obj.json.result.toString() == "true") {
valid = false;
} else {
valid = true;
}
return valid;
},
scope: this
},
failureCallback: {
fn: function(obj){
valid = false;
},
scope: this
}
});
return valid;
};