Declined
Last Updated: 25 Nov 2021 13:26 by ADMIN
Anthony
Created on: 23 Apr 2015 08:21
Category: MaskedTextBox
Type: Feature Request
3
allow optional inputs in maskedtextbox
Given a pattern of "90:00", if someone types '2:' it will presently reject the ':'
What would be better is a pattern of "9?0:00" where the '?' indicates an optional character. Then if someone types "2:" it could recognize the optional character and automatically insert a space. 
  The same would apply for dates, e.g. "00/00/0000", would become "0?0/0?0/0000" and then you could type "2/4/2015" and it would insert the spaces
  The benefit of this is that the user can see what format is expected but can also type in a faster manner
3 comments
ADMIN
Telerik Admin
Posted on: 23 Apr 2015 09:46
Thanks for the proposal.

Since this would require rather specific logic for masked textbox value parsing, you may consider using standard textbox and your own custom logic with appropriate regex definition. Also feel free to share your own implementation here, if you come up with such.

We could hardly support this behavior out-of-the-box.
Anthony
Posted on: 23 Apr 2015 09:19
This does what I want it to, it's just that it looks like code that could be broken by a future Kendo release. I appreciate that this is looking less like a uservoice post and more like a support call :-)

http://dojo.telerik.com/EbEhu
Anthony
Posted on: 23 Apr 2015 08:43
Rather than do the complex logic above you could just add an event, Keypress, to allow the user to modify the value before you run your own pattern matching on it, e.g. a sequence would be

- Type 2
- Type ':'
- new kendo event fires
- users code sees the ':' and changes the input value to ' 2'
- kendo code runs, it sees ' 2', the next character is a ':' which is allowed,
etc

This would also allow users to type other characters and get it automatically
changed, e.g. someone could type ' 2.00' and the code would change it to 
' 2:00' for dates, or for currencies they could do the same thing, changing '2.00' to '2,00' (Europe)