How can I use "validate" Event (telerik doc) in Custom Validation?
Example code:
<script type="text/javascript">
//register custom validation rules
(function ($, kendo){
$.extend(true, kendo.ui.validator, {
rules: { // custom rules
productnamevalidation: function (input, params) {
if (input.is("[name='ProductName']") && input.val() != "") {
input.attr("data-productnamevalidation-msg", "Product Name should start with capital letter");
return /^[A-Z]/.test(input.val());
}
return true;
}
},
messages: { //custom rules messages
productnamevalidation: function (input) {
// return the message text
return input.attr("data-val-productnamevalidation");}
},
validate: function (e){
console.log(e.valid);
}
});
})(jQuery, kendo);
</script>
In the above code "e.valid" should return true if validation passed, false otherwise. My issue is that the validate event is never triggered on validation complete. Am I using this the right way? Please note that the above custom validation code is for grid custom editor templates. Not sure if the configuration has to be done differently in such cases.
Any help with this is appreciated.
Thanks.