Hi,
I have a Kendo Validator with some custom rules, including hitting an API to prevent name duplication.
rules: {
noDups: function (input: any) {
if (input[0].id == "Name") {
let url = $("#duplicate-link").data("url") + "?name=" + input.val();
$.get(url, function (response) {
return !response;
});
}
return true;
},
Basically, if the name comes back as "already found" from the API, return false.
I have logged the output and the response is returning false when the name matches.
However, when validating the form, only the required validator is firing. I don't see the false return value affecting the validator's red box and validation message, and the form still submits.
$("#submit").on("click", function () {
let validator = $("#form1").data("kendoValidator");
if (validator.validate()) {
console.log('validated');
}
});
@(Html.Kendo().TextBoxFor(m => m.Name).HtmlAttributes(new { @class = "form-control", placeholder = "Application Name", required = true, data_noDups_msg = "This field is required" }))
Any thoughts? Thanks!