Copy link to clipboard
Copied
I have a telephone number field in a "fill-in" PDF file.
I'm using a Custom Format Script to create a multi-line Tool Tip.
this.getField("Preferred_Phone_Number").userName = "Enter Preferred Phone Number (10-Digits)\n(Ingrese el número de teléfono preferido)";
Then, in the same field, I go to the Format Tab and choose Select format category and choose Special, Phone Number. Everything appears to be working, the multi-line tool tip and the phone number format. (123) 456-7890.
Now, if I need to modify the multi-line Tool Tip, the Java Script under Custom Format Script is gone? I have to recreate the entire Java Script? WHY? Then I have to reselect the Special Phone Number format. Am I doing something wrong?
Can't Adobe Acrobat remember 2 different formats?
BTW, running Adobe Acrobat Standard 2020.
Copy link to clipboard
Copied
You'll need an automation tool to do this. You can download one here.
https://www.pdfscripting.com/public/Free_Acrobat_Automation_Tools.cfm
It works on standard the same as Reader.
Copy link to clipboard
Copied
What script do you use under Custom Format Script?
Copy link to clipboard
Copied
It was in my original post. But here it is again.
this.getField("Preferred_Phone_Number").userName = "Enter Preferred Phone Number (10-Digits)\n(Ingrese el número de teléfono preferido)";
Copy link to clipboard
Copied
EDIT: I misread your post. Why not set tool tip manually?
Copy link to clipboard
Copied
Hi again Nesa,
You have the script that provides the multi line tool tip.
Can you provide me with the script that I need to add to also format the telephone number as: (###) ###-####?
Copy link to clipboard
Copied
Try this:
event.target.userName = "Enter Preferred Phone Number (10-Digits)\n(Ingrese el número de teléfono preferido)";
if(event.value)
event.value = util.printx("(999) 999-9999", event.value);
Copy link to clipboard
Copied
Well? It works, except.
Now there's no validation. They have to enter 10 digits for a telephone number.
I can limit them to a maximum of 10 digits, but I can't prevent them from entering fewer than 10 digits.
For example: 2125551212 returns (212) 555-1212, but 212555121 returns (212) 555-121. No error checking.
Copy link to clipboard
Copied
Yes, you are doing something wrong, actually more than one thing. There can be only one format script, you cannot have both the custom script and the special formatting. Both are in fact scripts that occupy the same space.
The tooltip script is not related to formatting so it can be placed somewhere else. For example the custom Validation Script would be perfect for this.
However, the tooltip script is unnecessary. The tooltip only needs to be set once, not every single time the field is updated. So, run your tooltip script from the console window to set the tooltip once. Then save the file, and your done.
Copy link to clipboard
Copied
Can you direct me as to how I get to the console window?
I'm running Adobe Acrobat Standard 2020.
I've watched educational videos on YouTube, and when he clicked on the Main Tools Tab, and scrolled to the very bottom, the video shows a JavaScript Tool where he clicked on open.
But, I don't have that JavaScript Tool Icon.
Copy link to clipboard
Copied
You'll need an automation tool to do this. You can download one here.
https://www.pdfscripting.com/public/Free_Acrobat_Automation_Tools.cfm
It works on standard the same as Reader.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now