Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Show input mask on blank field #80

Closed
zarko opened this issue Nov 13, 2013 · 14 comments
Closed

Show input mask on blank field #80

zarko opened this issue Nov 13, 2013 · 14 comments

Comments

@zarko
Copy link

zarko commented Nov 13, 2013

Is there an option to show the mask on blank field (e.g. underscores (__) __ - ___ ).

I think that it would be helpful for the user to know what is expected format in advance.

@igorescobar
Copy link
Owner

Like a HTML5 placeholder attribute or like maskedinput plugin?

@andrewrota
Copy link

Would a feature like the maskedinput be possible? So an option make the mask visible on a blank field, but also while the user is typing?

@igorescobar
Copy link
Owner

@andrewrota It's not on my plans to be equal of maskedInput. Personally, I also think that we can solve that problem using an simple placeholder. Increase the source code for this?... I don't know... jQuery Mask Plugin is here to be lightweight.. I have to be careful when coding new features.

@hugochinchilla
Copy link

+1

I was using maskedinput but due lack of support for complex masks I'm migrating the code to this plugin. I used the visible placeholder feature and would like to keep it. I don't think it would add too weigth to the library.

@igorescobar
Copy link
Owner

@hugochinchilla On the way maskedInput implements, yes it would... unfortunately. But, I'm totally open for pull requests... Maybe I'm seeing this wrong.

@igorescobar
Copy link
Owner

There is two ways I see on implementing this feature the easy one and hard one:

1 - Simply converting your mask like .mask('00/00/0000') to a HTML5 place holder like __/__/____ (easy and lightweight) and when field got focused it disappear.
2 - And there is a "fancy" (and totally unnecessary on my humble opinion) way which is implemented by maskedInput. Your mask is converted into a "interactive" place holder... it doesn't disappear when your field got :focus ... the placeholder remains on the "background" along with what the user is typing like 00/__/____ and you can move the caret position and type valid digits where ever your want like 00/_0/__0_.

@hugochinchilla
Copy link

I like the "fancy" way, but you've got a point. Will try to think of a simple and lightweight solution later.

@igorescobar
Copy link
Owner

;)

@anilkumar8212
Copy link

When this will be available?
:)

@igorescobar
Copy link
Owner

@anilkumar8212 read the thread... and help me with it ;-)

@hugochinchilla
Copy link

@igorescobar the other day I read your reply by email and I didn't notice the formating in the first option you propose. I like it, there is no real need for the "fancy" way in option 2. The library could use the html5 place holder when available, and perhaps implement a polyfill when not.

@igorescobar
Copy link
Owner

@hugochinchilla jQuery Mask will never let you insert a value in value attribute field which is not valid so... the polyfill version is kind of... tough to implement without broke other stuffs.

@igorescobar
Copy link
Owner

I'm not going to implement the "MAGIC" placeholder because it adds unecessary complexity to the code in case of recursive masks so I just added support to the HTML5's placeholder and you can check it out with v1.6.0.

$('.field').mask('00/00/0000', {placeholder: "__/__/____"});

Enjoy it ;)

@albertsandig
Copy link

any dateformat? like mm/dd/yyyy?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

6 participants