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

KendoMaskedTextBox bind unmasked value

7 Answers 456 Views
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 09 Nov 2018, 09:54 PM

How can I make the KendoMaskedTextBox for Vue bind with v-model against the unmasked value?  For example, if my mask is "00000-0000" for a US postal code, and I enter "30157" in the control, it will currently bind "30157-____".  I need it to bind as "30157" (no hyphen, and no underscores).  I could strip out what I don't want on the server, but it seems like that shouldn't be necessary.

 

7 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 13 Nov 2018, 01:46 PM
Hello Michael,

You can use computed property and raw() method of the maskedtextbox, which will return you the value without the mask. The Example below shows such implementation:

https://stackblitz.com/edit/w3zycn-wrqpqy?file=index.html

Hope this would help.


Regards,
Nencho
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 15 Nov 2018, 07:39 PM
Thanks!  We're using v-model against a property on an object that came back from a service call.  I think ideally, there would just be an option you can specify on kendoMaskedTextbox that tells it whether to bind against the raw value or not.  That would have required zero changes in my component, and just a minor change in the template.
0
Accepted
Nencho
Telerik team
answered on 19 Nov 2018, 03:25 PM
Hello Michael,

I understand your point. That being said, I can suggest you a slight alternative of the previous approach:

https://stackblitz.com/edit/w3zycn-wrqpqy?file=index.html

The above example following the Vue Model Binding and it does require only a specification of the value for the model:

https://www.telerik.com/kendo-vue-ui/components/framework/model-binding/#toc-events

Hope this would help.

Regards,
Nencho
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 19 Nov 2018, 07:21 PM
That does seem to work in conjunction with v-model as well, so we at least have something that works from the view.  I think other people are going to need this capability too, and it should just be a simple boolean property to control how it binds, if you're able to log that somewhere.  Thanks!
0
Nencho
Telerik team
answered on 21 Nov 2018, 01:07 PM
Hello Michael,

I have created a Feature Request on your behalf in your brain new Feedback Portal below:

https://feedback.telerik.com/kendo-vue-ui/1362250-add-the-ability-to-implement-model-binding-to-the-raw-value-of-the-maskedtextbox

You can vote for and track the item in the link above.

Regards,
Nencho
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Zerry
Top achievements
Rank 1
answered on 18 Mar 2019, 05:11 AM
[quote]Nencho said:Hello Michael,

I understand your point. That being said, I can suggest you a slight alternative of the previous approach:

The above example following the Vue Model Binding and it does require only a specification of the value for the model:

Hope this would help.

Regards,
Nencho
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

[/quote]

I think ideally, there would just be an option you can specify on kendoMaskedTextbox that tells it whether to bind against the raw value or not.

0
Nencho
Telerik team
answered on 19 Mar 2019, 08:07 AM
Hello Michael,

Thanks for the additional specification. Generally, I would suggest you have your comment added to the FeedBack portal as well. I have updated it, though, having your comment added to the specification of the item.

https://feedback.telerik.com/kendo-vue-ui/1362250-add-the-ability-to-implement-model-binding-to-the-raw-value-of-the-maskedtextbox

Thanks for your suggestion!

Regards,
Nencho
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Michael
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Michael
Top achievements
Rank 1
Zerry
Top achievements
Rank 1
Share this question
or