Skip to main content
Known Participant
July 23, 2024
Answered

How to set date conditions on PDF?

  • July 23, 2024
  • 1 reply
  • 593 views

Hello,

I need to set date conditions so that when a student enters a date into the ORIGINAL EXAM DATE field, it is BEFORE today; and when a student enters a date into the PROPOSED EXAM DATE field, it is AFTER today.

 

Thank you!

This topic has been closed for replies.
Correct answer try67

To reject the entered value it's better to use:

event.rc = false;

Instead of:

event.value="";

The former will revert the field to its previous value, instead of clearing it altogether.

1 reply

PDF Automation Station
Community Expert
July 24, 2024

Assuming the date fields are formatted as mm/dd/yyyy, enter the following custom validation script into the Original Exam Date field:

if(event.value && util.scand("mm/dd/yyyy", event.value)> new Date())
{
app.alert("Date must be before today.",1)
event.value="";
}

 

Enter the following custom validation script into the proposed exam date:

if(event.value && util.scand("mm/dd/yyyy", event.value)<= new Date())
{
app.alert("Date must be after today.",1)
event.value="";
}

try67
try67Correct answer
Community Expert
July 24, 2024

To reject the entered value it's better to use:

event.rc = false;

Instead of:

event.value="";

The former will revert the field to its previous value, instead of clearing it altogether.