Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

mask SSN with floating field

Avatar

Level 1

On my form, I want to give the user the option to mask SSN. If checkbox = true, then only display last 4 digits of the SSN.  Then in the document, it will display value via a floating field.  I cannot figure out how to concatenate the mask and only display the last 4 digits of the SSN string.  The Display pattern for ParticipantSSN text box and floating field is text{999-99-9999}

In the checkbox mouseup event, I have this javascript:

var PSSN = ParticipantSSN.rawValue; // Length is 9

var mask = "XXX-XX-";

if(chkPredact.rawValue == false) {

fltParticipantSSN.rawValue = PSSN;

}else{

fltParticipantSSN.rawValue = concat(mask + slice(PSSN,6,4));

}

Thank you in advance

Mike

1 Accepted Solution

Avatar

Correct answer by
Level 1

var PSSN = ParticipantSSN.rawValue; // Length is 9

var mask = "XXX-XX-";

if(chkPredact.rawValue == false) {

fltParticipantSSN.rawValue = PSSN;

}else{

fltParticipantSSN.rawValue = mask + PSSN.substring(5,9);

}

View solution in original post

1 Reply

Avatar

Correct answer by
Level 1

var PSSN = ParticipantSSN.rawValue; // Length is 9

var mask = "XXX-XX-";

if(chkPredact.rawValue == false) {

fltParticipantSSN.rawValue = PSSN;

}else{

fltParticipantSSN.rawValue = mask + PSSN.substring(5,9);

}