1 Reply Latest reply on Jul 5, 2017 8:27 AM by chaddanielb

    Sequential Autofill dates from original date entry

    chaddanielb

      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.