Skip to main content
cmvarga5
Known Participant
May 16, 2025
Answered

Temporary (Placeholder) Text in Form Field but for Numbers only

I have this script:

 

if (!event.value) {

event.value = “Enter message here”;

event.target.display = display.noPrint;

} else {

event.target.display = “display.visible;

}

 

How can I use it for numerical format only?

PDF Automation Station
Community Expert
May 16, 2025

Enter the following scripts:

Custom Format:

AFNumber_Format(2,0,0,0,"",true);
if (!event.value)
{event.value = "Enter message here";}

 

Custom Keystroke:

AFNumber_Keystroke(2,0,0,0,"",true);

 

Custom Calculation:

if(!event.value)
{event.target.display = display.noPrint;}
else
{event.target.display = display.visible;}

 

Your script has curly quotes and a curly quote in front of display.visible.  Make sure you use a plain text editor like Notepad to write your scripts.

9 replies

PDF Automation Station
Community Expert
Community Expert
May 16, 2025

Enter the following scripts:

Custom Format:

AFNumber_Format(2,0,0,0,"",true);
if (!event.value)
{event.value = "Enter message here";}

 

Custom Keystroke:

AFNumber_Keystroke(2,0,0,0,"",true);

 

Custom Calculation:

if(!event.value)
{event.target.display = display.noPrint;}
else
{event.target.display = display.visible;}

 

Your script has curly quotes and a curly quote in front of display.visible.  Make sure you use a plain text editor like Notepad to write your scripts.

Translate
Nesa Nurani
Community Expert
Community Expert
May 16, 2025

@PDF Automation Station Nicely handled.
Just a tip, when using AFN you can place script in function in document level and then call it from keystroke, that way script won't disappear.

Translate
PDF Automation Station
Community Expert
Community Expert
May 17, 2025

Perfect.  Thank you @Nesa Nurani .  I'm always learning from you.

Translate
Nesa Nurani
Community Expert
Community Expert
May 16, 2025

If the field is formatted as number you can't have a placeholder message, you can use tooltip or workaround by using two fields.

Translate
cmvarga5
cmvarga5Author
Known Participant
May 16, 2025

Ok thank you!

Translate