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

Expiration date auto-fill, but only if "Annual" box is checked

New Here ,
Jan 25, 2023 Jan 25, 2023

Copy link to clipboard

Copied

I need to set up an auto-fill date field that is the last day of the year based off of another date field but only if "Annual" box is checked. If "One-time Use" box is checked, I need the expiration date field to be selectable manually and not auto-fill. Is this possible?

Example: "Annual" box is checked and "Requested Start Date" field is entered as 1/23/23, I need the "Expiration Date" field to auto-fill as 12/31 of the same year as the Requested Start Date Field (so it would be 12/31/23). If someone selects 2/2/24 as start date, I need the expiration date field to be 12/31/24, etc. The expiration date always needs to be the last day of the year of the start date field, but ONLY if the "Annual" check box is selected.

TOPICS
JavaScript , PDF forms

Views

192

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 ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

LATEST

Well yes, this is possible with a script. The best option is to use a calculation script in the Expiration Date field. 

You really don't even need to use proper date calculations since the end date is well known.  Just split the Requested Start Date Field to get the year, then use it to build the Expiration Date string. 

 

 

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