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

Show Raw Value in Form

4 Answers 186 Views
MaskedTextBox
This is a migrated thread and some comments may be shown as answers.
StevenDom
Top achievements
Rank 1
StevenDom asked on 11 Mar 2015, 08:17 PM
I have a MastedTextbox in a form. It is for zip codes that use the 00000-0000 mask. When I send the data to the back-end I strip the -____ off if only 5 digits were entered. This part works fine.

When displaying the form I would like to be able to show the zip code as 12345 (if 5 digits entered) or 12345-6789 (if nine digits were entered). If the MaskedTextbox is in a grid I can do this with a template such as template: '#= (zip) ? formatZipCode(zip) : " " #'. How do I do this in a normal form?

Thanks

Steven

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 Mar 2015, 10:03 AM
Hello Steven,

In general, the widget will display the value formatted using the defined mask. If you would like to avoid showing the prompt characters, then I would suggest you set the clearPromptChar option to true. This will force to widget to display the value without showing the empty places using the prompt char.

Let me know if this does not help.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Georgi Krustev
Telerik team
answered on 13 Mar 2015, 10:03 AM
Hello Steven,

In general, the widget will display the value formatted using the defined mask. If you would like to avoid showing the prompt characters, then I would suggest you set the clearPromptChar option to true. This will force to widget to display the value without showing the empty places using the prompt char.

Let me know if this does not help.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
StevenDom
Top achievements
Rank 1
answered on 16 Mar 2015, 12:22 PM
That fix only partially helps. In the case of zip codes, where only five digits are entered (both five and nine digits are acceptable) I still get 12345-, since the dash is in the mask. I need a way to format the raw values from the database, where I store the digits without a mask at all.
0
Georgi Krustev
Telerik team
answered on 18 Mar 2015, 08:48 AM
Hello Steven,

In that case, you can try the newly added unmaskOnPost option that will strip the value before form post. If you would like to get the raw value using widget's API then you can check the raw method.

Note that this functionality will be available in Q1 2015 release that is going to be released today.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MaskedTextBox
Asked by
StevenDom
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
StevenDom
Top achievements
Rank 1
Share this question
or