imaskjs icon indicating copy to clipboard operation
imaskjs copied to clipboard

Redaction support in mask

Open anil131990 opened this issue 4 years ago • 3 comments

Hi,

I have a field that captures SSN. Currently I use mask 000-00-0000 to capture it. There is a need to hide the first five characters as the user types in. The mask for same would look like XXX-XX-0000, where X maps to 0 (pattern), but does not show the typed digit. e.g. masked value = XXX-XX-3434 unmasked value = 123453434

Is there a way to achieve this?

Thanks, Anil

anil131990 avatar Jan 17 '20 04:01 anil131990

Hi! Sorry for delay.

Currently there is no such thing. But you are not the first who asked about it, so i consider adding it in next release. If you need it right now, then can take a look at MaskedPattern class and its definitions to override charater for masked.

uNmAnNeR avatar Jan 23 '20 10:01 uNmAnNeR

If you need it right now, then can take a look at MaskedPattern

I extended the class MaskedRegExp class and added some behavior. Added example Is this what you recommend? Thanks

anil131990 avatar Jan 26 '20 17:01 anil131990

Hm... looks closely, but not complete: only lazy mode is working and input inside XX breaks everything. Going this way i suppose you have to copy-paste almost all stuff in input-definition.js to get it work correctly. But i don't see better way without changing PatternInputDefinition interface in lib itself.

uNmAnNeR avatar Jan 27 '20 08:01 uNmAnNeR