Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

I am trying to masked an SSN field depending on if yes is choosen or not

Avatar

Avatar
Validate 1
Level 2
lpianwi
Level 2

Like

1 like

Total Posts

69 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
lpianwi
Level 2

Like

1 like

Total Posts

69 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
lpianwi
Level 2

30-04-2013

Hi All, Good morning. I am working on a form that should display a masked SSN field in the format of XXX-X9-9999. I did come across the following script on the Adobe Designer forum, and apply it to my form creating two fields, and put the code on the exit event, but it is not working. Please what is wrong with the code, and is there any other way it could be done?

if(form1.page1.subform1.Maskedfld1.rawValue != null) {  
var ssn = form1.page1.subform1.Maskedfld1.rawValue;  
var regExp = /^(\d{9}|\d{3}-\d{2}-\d{4})$/;  
if (regExp.test(ssn)) {    
regExp = /^\d{9}/;
      if (regExp.test(ssn)) {
      this.rawValue = "***-**-" + ssn.substring(5,9);
     form1.page1.subform1.Maskedfld2.rawValue = ssn;     }
      else {
          this.rawValue = "***-**-" + ssn.substring(7,11);
          ssn = ssn.substring(0,3) + ssn.substring(4,6) + ssn.substring(7,11);
          form1.page1.subform1.Maskedfld1.rawValue = ssn;
      }
} else {
   xfa.host.messageBox("SSN must be in the form 123-45-6789 or 123456789.","SSN Error",0,0);
    xfa.host.setFocus("form1.page1.subform1.Maskedfld1");
   }
}


Thanks

v/r

Tammy

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Affirm 1
Level 1
Hibou
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
View profile

Avatar
Affirm 1
Level 1
Hibou
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
View profile
Hibou
Level 1

23-07-2013

I tried the same code on a single field on exit event, with just one modification: Maskedfld2 replaced with Maskedfld1

It does mask the value.

Can you please be more specific as to what is the expected behaviour.

Thanks