• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Validating Start Date is within 90 Days from Today

New Here ,
Jun 06, 2020 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

Views

516

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
community guidelines
Community Expert ,
Jun 07, 2020 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?

Votes

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
community guidelines
Community Beginner ,
Jul 25, 2022 Jul 25, 2022

Copy link to clipboard

Copied

LATEST

Hello, recognized your name from my other post 🙂 I'm also trying to figure out the above. If the date entered is greater than 90 days, I need an error message to display. Format is m/dd/yyyy. Any help is super appreciated. Thanks. 

Votes

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
community guidelines
Community Expert ,
Jun 07, 2020 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.

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
community guidelines