Show Raw Value in Form

5 posts, 0 answers
  1. StevenDom
    StevenDom avatar
    14 posts
    Member since:
    Aug 2014

    Posted 11 Mar 2015 Link to this post

    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
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 13 Mar 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 13 Mar 2015 Link to this post

    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!
     
  5. StevenDom
    StevenDom avatar
    14 posts
    Member since:
    Aug 2014

    Posted 16 Mar 2015 in reply to Georgi Krustev Link to this post

    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.
  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 18 Mar 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready