Highlighted

Validating Start Date is within 90 Days from Today

New Here ,
Jun 06, 2020

Copy link to clipboard

Copied

In a created form, I am trying to figure out how to use javascript to ensure that a selected date in a date field labeled "Start Date" is greater than 90 days from the current day/today. I would also like to implement alerts to convey a message to the user when the start date is greater than, less than, and equal to 90 days. I dont have any experience in javascript. Can anyone help with this?

Topics

Acrobat SDK and JavaScript, General troubleshooting, How to, PDF forms

Views

176

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Validating Start Date is within 90 Days from Today

New Here ,
Jun 06, 2020

Copy link to clipboard

Copied

In a created form, I am trying to figure out how to use javascript to ensure that a selected date in a date field labeled "Start Date" is greater than 90 days from the current day/today. I would also like to implement alerts to convey a message to the user when the start date is greater than, less than, and equal to 90 days. I dont have any experience in javascript. Can anyone help with this?

Topics

Acrobat SDK and JavaScript, General troubleshooting, How to, PDF forms

Views

177

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Jun 07, 2020

Copy link to clipboard

Copied

What should happen if it's not? Should the value be rejected, or just show an error message?

What is the date format of that field?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jun 07, 2020

Copy link to clipboard

Copied

Dates are more complicated than regular calculations because Dates are more complex. 

You can read about scripting for Date Handling here:

https://acrobatusers.com/tutorials/date_time_part1/

https://acrobatusers.com/tutorials/date_time_part2/

 

There are two important bits for such a script

1) Parsing the entered date text into a Date object

2) Adding 90 days to the current date so the date objects can be compared.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF