Code for displaying "*" after inputing a social security number
Copy link to clipboard
Copied
Is there a code that will change numbers to "*" after inputing a Social Security Number into a text box. Yet if I click in the box I can view what the number is?
Copy link to clipboard
Copied
You can use this as 'Custom Format' script:
if(event.value)
event.value = event.value.replace(/./g, '*');
Copy link to clipboard
Copied
Be aware this is absolutely not a safe way to hide the text the user enters, unless they print out the file.
In the digital version of the file it will be trivial to get the actual value from the field. If you want to actually replace the numbers with an asterisk then you can't use the Format event. But in that case what's the point of entering it at all?
Copy link to clipboard
Copied
There is no need for any code, this option is available in the field Properties:
(Note that the data in the field is not saved when the document is saved to disk)
Acrobate du PDF, InDesigner et Photoshoptographe
Copy link to clipboard
Copied
@JR BoulayIf used that then you can't see number when you click in field which is what OP asked.
Yet if I click in the box I can view what the number is?
Copy link to clipboard
Copied
You're right.
I thought this was its default behaviour, but I checked and it's not.
You need to add two lines of script as in the attached example.
On Focus:
event.target.password = false;
On Blur:
event.target.password = true;
Acrobate du PDF, InDesigner et Photoshoptographe

