rule helper

Previous Next

The rule helper can be used to add domain attributes to an HTML element. Domain attributes can be used by domain validators.


{{ rule "*" }}

The "*" parameter is required.



<input {{rule "*"}}/>

can be converted to:

<input udb-mandatory="true" udb-ioformat="DD-MM-YYYY"/>



The added attributes are used for field validation. The construct iterates over all attributes of a JSON control definition and adds rule attributes depending on whether a rule has been defined for that attribute in the factory definition:

$.udb.ui.registerControl("Control", null, {


 templateOptions: {

         data: {

                 rules: {

                         mandatory: function(value, options) {

                                 return (value ? {rule: "udb-mandatory", value: true} : undefined);







At this time, rule attributes are supported for mandatory, io-format, domain values and numeric values.