Copy link to clipboard
Copied
I have a form that brings information from my core system and plugs into the mapped fields. One of the fields is applicant social security number. This field comes over from the core as the 9 digit social security number, which then populates on the form. The core company does not offer a masked version of this field.
How can I set the text field to mask the first 5 of the social security with X's(or whatever at this point). I'm self taught so I'm not versed in any scripting that would make this possible. I attemtped to use an Arbitrary Mask format but that didn't work. Any help would be appreciated!
Copy link to clipboard
Copied
I would use the Custom Format script option for the text field. This will mask the displayed value but still allow input and editing of the full SSN. You could also create a keystroke script to accept the 9 digit or the edited SSN. You may needformat to set the format to None. A possible sctipt could be:
if(/^(\d{3}[-. ](\d{2}[-. ](\d{4}$/).test(event.value) == true){
event.value = "***-**-" + RegExp.$3;
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Do you mind sharing your solution? I have the exact situation that I'm working to solve for.
Copy link to clipboard
Copied
Hi! I honestly don't think my method is the "correct" method, but what I did works and haven't had any problem for the last 4-5 years. For my scenario I was using a text field that is called MEMBER_TIN and I wanted to mask the first 5 of the TIN and leave the last 4
In the Text Field Properties of the MEMBER_TIN text field, click the Calculate Tab
* Custom Calculation Script is:
event.value = this.getField("MEMBER_TIN").valueAsString.substr(-4);
Then, go to the Format tab of the text field properties box and select Custom from the Select format categor
*Custom Format Script is:
if(event.value) event.value = "XXX-XX-" + event.value;
This made the 9 digit social (say it's 123-45-6789) and turned it into XXX-XX-6789
you can remove the hyphens if you just wanted to mask regular numbers, change the X to whatever you want the "masking" to be, and in the custom calculation script the (-4) was how many numbers I wanted to leave at the end, so if you wanted 2 you would just do (-2).
Again, I'm sure people will find a lot wrong with this, but it works! Hope it helps you 🙂
Copy link to clipboard
Copied
To change 123-45-6789 to XXX-XX-6789 use this as custom format script of that field:
event.value = event.value.replace(/^(\d{3})-(\d{2})-(\d{4})$/, 'XXX-XX-$3');
Copy link to clipboard
Copied
Thank yo so much!!! This is exactly what I needed. 🙂