This is a migrated thread and some comments may be shown as answers.

MaskedTextBox - data-mask attribute not working correctly?

2 Answers 514 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Kevin F
Top achievements
Rank 1
Kevin F asked on 04 Mar 2016, 05:39 PM

Using kendo SPA and I have the following:

<input type="text" id="txtBillingZip" data-role="maskedtextbox" data-mask="00000" />

For some reason, the mask doesn't work.  But when I change the mask to this: 

<input type="text" id="txtBillingZip" data-role="maskedtextbox" data-mask="00000 " />

The mask works as expected, but of course has the space at the end which I don't want.

Any thoughts?

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 08 Mar 2016, 01:48 PM
Hi Kevin,

When declarative widget initialization is used, the Kendo UI library parses number-like options as numbers. As a result, the mask attribute is parsed to a single zero digit and cannot be processed correctly in the Kendo UI MaskedTextBox initialization.

Please check the following help section...

http://docs.telerik.com/kendo-ui/framework/mvvm/overview#important-notes

... or use script initialization instead of declarative one:

$(document).ready(function(){
$("#maskedtextbox").kendoMaskedTextBox({
mask: "00000"
});
});

I hope this helps.

Regards,
Dimiter Topalov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kevin F
Top achievements
Rank 1
answered on 08 Mar 2016, 07:04 PM
Oh jeez.  I swore I read that page 100 times.  Sorry about that, and thank you very much Dimiter!
Tags
MVVM
Asked by
Kevin F
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Kevin F
Top achievements
Rank 1
Share this question
or