cleave.js
cleave.js copied to clipboard
Value stripped when prefix
I am trying to mask a US SSN by using prefix. It strips the actual value.
https://jsfiddle.net/cz5vrkmj/
The last version that works is 1.4.7, which indicates https://github.com/nosir/cleave.js/pull/440 caused the bug
This is still a problem for us. I can defeat it on load with noImmediatePrefix
. But we are masking this data, our process is
- User types
123121234
- We mask it and send in a value of
•••••1234
+ change the prefix to•••••
- Then this code block strips it:
https://github.com/nosir/cleave.js/blob/e3fa6f3637fa6d8ea97ef66ac1957950632b72ab/src/utils/Util.js#L104-L113
I'm not understanding why that code should return an empty string in this scenario. Commenting out that entire block fixes it while still allowing all other uses of this lib in our codebase to continue to work. Help me understand what the intended purpose of this code is and I'm happy to submit a PR!
@benogle hi! Did you manage to solve this problem? Did they answer you? I can't do onChange in react either.