ui-mask
ui-mask copied to clipboard
The optional character should be really optional
Greetings, thanks for the great plugin. I have some kind of feature request...
Real live example:
In my projects form I have field power_capacity which measures in liters, I have a mask 9?9.9, the idea was that a user that has 1.6 liters in their car enter two character - 1 and 6, but those who have more that 9.9 liters would type '1' '2' '5' for 12.5 liters engine.
But in fact I get this
So the optional parameter appear as one that should be typed, and typed first.
My proposition: first fill the required character, then fill optional. (or at least an option for turning this ability on) And is there any known workaround for my situation?
Thanks for the plugin! Even, I've a similar issue with my project requirements.
I am trying to create an input masking for an IP address field, which can be any structure such as: 192.168.123.212 192.168.12.21 192.168.1.2 192.16.1.2
How do I solve this problem with this plugin? Please let me know. It will be really helpful !! Thanks again.
@ANIRUDH190 It is possibly incorrect to say such things in someones repository, but I was actually able to accomplish what I described by using ngMask plugin for angular, the only downside is that ngMask does not display pattern in placeholder (so there will be nothing but empty input, no underscores or etc)
Hello @DanielFurmanov, I don't think your use case is ever going to be covered by this lib simply for the fact that is way easier to just use a number specific mask lib.
Have you tried using a lib with input masks for numbers/currency? I guess something like angular-input-masks is more appropriate for what you're trying to accomplish.
Edit: I'm not a maintainer of this repo and this would be really awesome to have, i just don't think this feature would be trivial to implement!
I'm curious how the optional character works at all. When I put a "?" in the demo, it seems to require a value there. I, too, would like to see it work like that. Only I would like it to cover decimal places, something like 99.9?9? so a user could type 88 or 88.25
Ok immediately after posting that I realized that my use-case does work if I format it correctly.. Question-mark first! 99.?9?9. Is this documented ANYWHERE? There is no Wiki page and the README.md doesn't have mention of this feature at all.
Another use-case that would be helpful is a date: ?99/?99/?9?999, this would allow for 1/1/11 or 01/01/2011 to be entered. I suppose resolving it to something might require some logic. The "01" is easy, just resolve the optional digits to 0, but the "20" in "2011" would require some logic by the developer utilizing the lib.