Brian Mains
Brian Mains

Reputation: 50728

Kendo Mask Custom Rule

I've setup the following custom rule in a Kendo UI MaskedTextBox:

rules: {
    "~": /[0-9#]/
}

I thought this would allow 0-9 or # in the field, but the mask text of ~ shows up and the masked box won't let me enter anything.

Where am I going wrong with the custom mask? How do I configure a custom mask which will allow entry into the masked text box?

Upvotes: 2

Views: 3555

Answers (1)

numaroth
numaroth

Reputation: 1313

I was unable to duplicate the asker's problem, but the following code should achieve the requested behavior:

<script>
  $(document).ready(function() {
     $("#with_mask").kendoMaskedTextBox({
       mask: "~~~~~~~~~~",
       rules: {
               "~": /[0-9#]/
              }
      });
   });
</script>

This Fiddle contains a working example.


These Kendo documentation links might be useful for any further problems:

Upvotes: 1

Related Questions