Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Masking SSN field for email and then unmasking to recipient?

Explorer ,
Dec 13, 2021 Dec 13, 2021

Hello, this may not be possible and if it is... I hope my question makes sense. Please be patient with me as I am still a beginner when it relates to custom script on Adobe DC. I am looking to put a field (let's say it is a field for a social security number). When the user inputs the social security number, it will mask it (to only show the last 4 numbers once entered). When the form is emailed the ssn will show masked. When the recipient receives the email, the recipient can access the full social security number (if they needed to access it). That's all Im trying to do and I hope this makes sense? Thank you in advance for your time and help!

 

NOTE - there is no such program as Adobe DC, moving to Acrobat

You need to ask program questions in the forum for the program you are using
To ask in the forum for your program please start at https://community.adobe.com/
Moving from Using the Community (which is about the forums) to the correct forum... Mod

TOPICS
How to
4.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Dec 14, 2021 Dec 14, 2021

You can use this code as the custom validation script of the "SSN" field:

 

this.getField("SSN Reveal").value = "";
if (event.value) {
	if (/^\d{3}-\d{2}-\d{4}$/.test(event.value)) {
		this.getField("SSN Reveal").value = event.value;
		var ssnParts = event.value.split("-");
		event.value = "XXX-XX-"+ssnParts[2];
	} else {
		app.alert("Invalid value.");
		event.rc = false;		
	}
}

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2021 Dec 13, 2021

"Masking" a value in a PDF is purely cosmetic. If you don't want sensitive information to be extracted from the file either don't enter it in the first place, or don't use a PDF file for this purpose, but a more secure way of transferring data.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2021 Dec 13, 2021

Is there a way to do it even for cosmetic purposes? Thank you for the prompt reply! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2021 Dec 13, 2021

I found this but it didnt work or I didnt place it in the correct field. 

 

// ssnformmasked::exit - (JavaScript, client)

if (ssnform.rawValue != null) {

var ssn = ssnformmasked.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);

ssnform.rawValue = ssn;

}

else {

this.rawValue = "***-**-" + ssn.substring(7,11);

ssn = ssn.substring(0,3) + ssn.substring(4,6) + ssn.substring(7,11);

ssnform.rawValue = ssn;

}

}

else {

xfa.host.messageBox("SSN must be in the form 123-45-6789 or 123456789.","SSN Error",0,0);

xfa.host.setFocus("ssnformmasked");

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2021 Dec 14, 2021

This code was written for an LCD form. It will not work in a regular PDF file.

 

So how should it work, exactly? What should trigger showing the full SSN, as opposed to masking part of it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 14, 2021 Dec 14, 2021

Hello and my apologies for the delay. You'd enter the # (123-45-6789) and it would automatically show (XXX-XX-6789) to the individual entering the information. Let's call the text field "SSN" and then another hidden field (accessible only by the recipient receiving the data) would get the full number. Let's call that field "SSN Reveal". I hope this makes sense? Oh and any forms would be sent through a secure server / message. I was able to confirm that. Thank you for your valuable time!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2021 Dec 14, 2021

You can use this code as the custom validation script of the "SSN" field:

 

this.getField("SSN Reveal").value = "";
if (event.value) {
	if (/^\d{3}-\d{2}-\d{4}$/.test(event.value)) {
		this.getField("SSN Reveal").value = event.value;
		var ssnParts = event.value.split("-");
		event.value = "XXX-XX-"+ssnParts[2];
	} else {
		app.alert("Invalid value.");
		event.rc = false;		
	}
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 14, 2021 Dec 14, 2021

You are my HERO!!! This is PERFECTION! That is EXACTLY what I needed. Thank you so very much!!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 16, 2024 Apr 16, 2024

Hello! I attempted using this a few times, but I must be doing something incorrectly, because it's not working for me. I am pasting the code but maybe in the wrong place? Can you advise?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2024 Apr 16, 2024
LATEST

This script won't work in an Adobe Sign form.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 14, 2021 Dec 14, 2021

If it's an SSN it shouldn't be in an email - even if cosmetically masked. You may have unlimited legal liabilities. You need to use a secure web server (https submit) with script written by a specialist.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines