top of page
The PC Tech

Adobe Acrobat - Preventing Entry of Future Date

Updated: Nov 14

Issue

You may have a situation where you need to prevent entry of a Future date in a field. You need to watch out for the differences in how date and time are obtained by different date objects to prevent changes in dates from morning to afternoon.

Important: replace the names used for getField with the actual field names you have.

Format tab: use the date format: mm/dd/yyyy

Action tab: Trigger is On Blur and Action is Run JavaScript

Script:

if (event.value!="") {

var d = util.scand("mm/dd/yyyy", event.value);

if (d.getTime()>new Date().getTime()) {

app.alert("You may not enter a date in the future.");

getField("DOB1").value="";

getField("DOB1").setFocus();

event.rc = false;

}

}

Resource

26 views0 comments

Comments


Commenting has been turned off.
bottom of page