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

Automated Date Text Fields

New Here ,
Dec 21, 2021 Dec 21, 2021

I am trying to create a automated form. 

 

I am trying to add in 7 days in the "Follow-Up Call Sched." text field, based off the date keyed in the first line ("Date of Call" field). For example, if I key in "12/22/2021" in the "Date of Call" text field, I would like to have Adobe automatically input "12/28/2021" into the "Follow-Up Call Sched." text field. 

 

How would I go about doing so? Thank you in advance for your help! 🙂 

 

Adobe Question.PNG

TOPICS
Create PDFs
295
Translate
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 ,
Dec 21, 2021 Dec 21, 2021
LATEST

Use this script in a custom Validation script for the "Date of Call" field. 

 

I'm assuming you have provided the correct field names in your post. It is critical that the field names are correct in order for the script to work.  It is also very important that a field name not end with a period. If this is the case, then change it. 

 

 

this.getField("Follow-Up Call Sched").value = "";
if(event.value != "")
{
    var dtCall = util.scand("mm/dd/yyyy",event.value);
    if(dtCall)
    {
        var dtFollowup = new Date(dtCall.setDate(dtCall.getDate() + 7));
        this.getField("Follow-Up Call Sched").value = util.printd("mm/dd/yyyy",dtFollowup);
    }
}

 

 

You can read more about date and time scrpting here:

https://www.pdfscripting.com/public/Date-and-Time-Handling.cfm

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

 

 

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

Translate
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