Unplanned
Last Updated: 01 Jul 2019 08:09 by ADMIN
Greeshma
Created on: 26 Jun 2019 15:59
Category: MaskedTextBox
Type: Feature Request
1
Always show the mask - with or without focus

I had a look at the Dojo Demo and made some changes to have prefix to the maskedtext. But on the first load if there are no match to the masked Text in this example an empty string , the prefix does not appear until unless clicked on the input. This causes a problem because the input should have the prefix regardless of any event occurring on it., and not null

Is there any way I can have the input populated with the prefix on load if the value has no match in masked text.

http://dojo.telerik.com/UbiWAPAV/2

 

3 comments
ADMIN
Alex Hajigeorgieva
Posted on: 01 Jul 2019 08:09
Hi, Greeshma,

The Kendo UI MaskedTextBox has a private property that can be used to access the mask, however, as with all private properties, make sure that the functionality works well on update. Private properties are subject to change without notice.

http://dojo.telerik.com/UbiWAPAV/5

<input id="masked" />
 
<script>
  $(function() {
    var masked = $("#masked").kendoMaskedTextBox({
      mask: "S\\AAA-AAA"
    }).data("kendoMaskedTextBox");
     
    if(!$("#masked").val()){
      $("#masked").val(masked._emptyMask);
    }
  });
</script>

I have also converted the private support thread to a public item and it is now available for voting at:

https://feedback.telerik.com/kendo-jquery-ui/1416024-always-show-the-mask-with-or-without-focus

I have added one vote on your behalf.

Thank you for your suggestion, the more votes it collects the sooner we will be able to consider it for future implementation.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Greeshma
Posted on: 28 Jun 2019 08:32

HI Alex,

Thanks for getting back. Having the masked text appear on focus and blur would be a good feature to have. Please go ahead and convert this ticket to a public feature request.

 

However the 2 solutions you provided assumes that we already know what the mask text format is or a predefined placeholder text. Is there a way to extract a mask text from the maskedtextbox control?

Thanks

ADMIN
Alex Hajigeorgieva
Posted on: 27 Jun 2019 09:11
Hello, Greeshma,

The behaviour of a Kendo UI MaskedTExtbox is such by design when the widget has no value - it shows as a regular text input. The mask is revealed on focus and hidden on blur.

On first load, you could check if the mask has value and se the value to the mask:

http://dojo.telerik.com/UbiWAPAV/3

if(!$("#masked").val()){
 $("#masked").val("SA__-___");         
}

Alternatively, you can provide a placeholder as shown in this how to article:

https://docs.telerik.com/kendo-ui/controls/editors/maskedtextbox/how-to/custom-placeholder.html

If you feel tht the mask should always be shown on blur and focus, I would suggest we open a feature request on your behalf. Our Kendo Angular and React widgets already implement this behaviour and I can see how that feels like better UX.

Let me know if you would like that and I can convert this ticket to a public feature request so people can vote or it.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.