My validation rule has to make a call to server. I have tried to add $http.get as part of myRule function but is not working.
Please see example code:
http://dojo.telerik.com/aJeXE/2
Thank you
2 Answers, 1 is accepted
0
Accepted
Alexander Popov
Telerik team
answered on 26 Sep 2014, 07:18 AM
Hello Wit,
I would recommend using a synchronous request to ensure that the response is received before the validation function has finished executing. For example:
function (input){
var valid = true;
if (input.is("[name='ProductName']") && input.val() != "") {
$.ajax({
type: "GET",
url: "someurl",
async: false
})
.success(function(data){
if(!data.someCondition){
valid = false;
}
});
}
return valid;
}
Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!