Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

auto-unmasking #397

Closed
elexx opened this issue Sep 5, 2018 · 8 comments
Closed

auto-unmasking #397

elexx opened this issue Sep 5, 2018 · 8 comments

Comments

@elexx
Copy link

elexx commented Sep 5, 2018

Hello,

I would like to propose a feature: auto-unmasking. When activating auto-unmasking the value of an input-element will return the raw value from cleave instead of the actually displayed value.

The problem with the current solution (getRawValue/setRawValue) is that there are frameworks that register change listeners on input elements which in turn read/write the value field. In such a case it is not possible to call getRawValue/setRawValue instead. In this case it would be nice to get the raw value from document.getElementById('myelement').value.

Regards, Alex

@lekoala
Copy link

lekoala commented Sep 10, 2018

hey,

i have a proposal : wouldn't be nice to have the option to set up an alternative input instead (like myInput becomes myInputFormatted) while to original input is converted to a hidden one?

this way, formatting is only a "ui" feature, and everything is transparent for the backend (where we can use simple formatting for numbers, dates, etc...)

and since the original id/name is preserved, any script listing to or requesting the value will get the proper, unformatted value.

@Abduvakilov
Copy link

Abduvakilov commented Nov 30, 2018

I would also like to see this feature in future release. The flatpickr plugin also has the same feature

@lekoala
Copy link

lekoala commented Nov 30, 2018

exactly, and it's very convenient :-)

@jadamec
Copy link

jadamec commented Mar 22, 2019

Anything new about this common feature? Thanks. :)

@nosir
Copy link
Owner

nosir commented Mar 30, 2020

The fake UI / Hidden input as suggest by @lekoala can be added.
My only concern is what if user has CSS attached to the id like #some-input, since after swapping input field, it's supposed to keep id for the hidden input field, but this is minor

@lekoala
Copy link

lekoala commented Mar 31, 2020

@nosir it is a valid concern. probably it would be best to copy classes (and favor classes over ids) from the original input if you want to enable this feature. it's a minor tradeoff in my opinion. good practice is about using classes over ids anyway.

@nosir
Copy link
Owner

nosir commented Apr 1, 2020

Released in https://github.com/nosir/cleave.js/releases/tag/v1.5.9
https://github.com/nosir/cleave.js/blob/master/doc/options.md#swaphiddeninput
Thanks

@leotuna
Copy link

leotuna commented Jul 8, 2021

I use .NET.

On form submit, it sends both values.

It should delete the masked form before, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants