Skip to main content
Participant
May 7, 2024 10:44 PM UTC
Question

Acrobat Forms: Don't Allow Prior Year Date Entries

I am creating an acrobat form with a date field. How can I prevent the user from entering a date from any year prior to the current year? 

For example it's 2024 now. If a user enters a date with 2023 for the year a message appears instructing them to use current year dates only. 

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Bernd Alheit
Community Expert
Community Expert
May 8, 2024 11:19 AM UTC

This script will not work in Acrobat Reader.

Translate
Abambo
Community Expert
Community Expert
May 8, 2024 10:47 AM UTC

Please note that you have defined a hard stop. On January first, they can't enter data from the prior year. Seems to be a bit to hard...

Translate
ABAMBO | Hard- and Software Engineer | Photographer
try67
Community Expert
Community Expert
May 8, 2024 10:20 AM UTC

As the custom Validation script of the field enter the following (adjust the date pattern as needed):

 

if (event.value) {
	var d = util.scand("mm/dd/yyyy", event.value);
	if (d.getFullYear()<new Date().getFullYear()) {
		app.alert("You may not enter a date from previous years.",1);
		event.rc = false;
	}
}
Translate