ui-mask icon indicating copy to clipboard operation
ui-mask copied to clipboard

The optional character should be really optional

Open DanielFurmanov opened this issue 9 years ago • 5 comments
trafficstars

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 ui-mask-issue 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?

DanielFurmanov avatar Nov 15 '16 10:11 DanielFurmanov

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 avatar Nov 16 '16 17:11 ANIRUDH190

@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)

DanielFurmanov avatar Nov 16 '16 19:11 DanielFurmanov

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!

RafaelTaranto avatar Dec 28 '16 00:12 RafaelTaranto

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

aplocher avatar Mar 09 '17 02:03 aplocher

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.

aplocher avatar Mar 09 '17 02:03 aplocher