Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Custom validation rules

$
0
0

Custom validators aren't reusable because they must filter by a jquery selector. It is also inefficient to run the validator on every input field. Seems like it would be better to extend Observable:

<inputdata-bind="validator: myValidator">

Another option is to pass the selector to a validation factory as in:

$("...").kendoValidator({
        rules: {
          x: xValidator("[name=...]")
        }
   });

function xValidator(selector) {

    return function(input) {

        return input.is(selector) && ...;

    }

}


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>