Skip to main content
cmvarga5
Known Participant
January 15, 2025
Answered

Need 2 or more custom formats at the same time

  • January 15, 2025
  • 2 replies
  • 506 views

I have a date field where I need a certain format for the date but I have a custom format script showing an instruction that will go away once the applicant types text in the field. 

 

For example, I want the applicant to see (MM/DD/YYY) on the text field. If they type in it, then that default instructional text will be replaced. I also want the date format (which is already available in the options) to be applied.

 

Here is the custom script I have for the default instructional text:

// Custom Format script for text field

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

 

Is it possible to have 2 or more custom scripts at the same time?

Correct answer PDF Automation Station

You actually need 3 scripts to do this.

Custom format script:

AFDate_FormatEx("mm/dd/yyyy");
if (!event.value) {event.value = "MM/DD/YYYY"}

Custom Keystroke Script:

AFDate_KeystrokeEx("mm/dd/yyyy");

Custom calculation script:

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

 

2 replies

PDF Automation Station
Community Expert
Community Expert
January 15, 2025

You actually need 3 scripts to do this.

Custom format script:

AFDate_FormatEx("mm/dd/yyyy");
if (!event.value) {event.value = "MM/DD/YYYY"}

Custom Keystroke Script:

AFDate_KeystrokeEx("mm/dd/yyyy");

Custom calculation script:

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

 

cmvarga5
cmvarga5Author
Known Participant
January 16, 2025

Thank you so much @try67 !!!

try67
Community Expert
Community Expert
January 15, 2025

No, you need to do it all in a single script.