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

Sequential Autofill dates from original date entry

New Here ,
Jun 23, 2017 Jun 23, 2017

Copy link to clipboard

Copied

I need a script that does exactly what the post linked here  describes, but I need to it work for INDD rather than Acrobat. Here is a copy of the question and solution from that original post:

I have 75 weeks of boxes that I need to auto-fill with sequential dates a week

a part based on whatever is entered in the very first date box.  From the example I show here I am filling in the first box for Week1 (box name: Week01) with 12/01/2015.  I want all the boxes running to the right of that to automatically fill in dates in one week increments based off the date in that first box.  The form field are named, Week02, Week03, Week04, etc....

I am no JavaScript wizard but after making several basic and more intuitive attempts, I realize this is beyond me.  I was hoping one of you JavaScript gurus out there could help me out with a simple script to add to each calculation field to make this work.date.jpg

try67

Correct Answerby try67 on Dec 11, 2015 1:45 AM

I'll give you an example for the first field. You can use it to figure out the rest.

  1. var s = this.getField("Week01").valueAsString; 
  2. if (s=="") event.value = ""
  3. else
  4.     var d = util.scand("mm/dd/yyyy", s); 
  5.     d.setDate(d.getDate()+7); 
  6.     event.value = util.printd("mm/dd/yyyy", d); 

You should use this code as the custom calculation script of Week02.

TOPICS
Scripting

Views

782

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
New Here ,
Jul 05, 2017 Jul 05, 2017

Copy link to clipboard

Copied

Any help on this?

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
New Here ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

LATEST

This is perfect, needed a little bit of tweaking for my use case but saved the day. Thank you.

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