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