Skip to main content
Participating Frequently
May 15, 2024
Answered

Adobe Pro script not working after duplicating to populate in multiple areas in consecutive order

  • May 15, 2024
  • 1 reply
  • 838 views

Hello, So I use script: 
var date = util.scand("mm/dd/yyyy", event.value);
if(event.value == "")
this.getField("Text20").value = "";
else {
date.setDate(date.getDate() +7);
this.getField("Text20").value = util.printd("mm/dd/yyyy", date);}

to count out a week from a certain date. I have thirteen boxes with this code so that each box will consecutively display the next date that is 7 days out from the box that is in line before it. I am running into an issue after about 6 boxes. The date stops displaying after the sixth box. When I go to clear the starting week, the weeks in the 7th box finally shows up, but only displays the 7th, 8th, and 9th box. When I clear the data from these boxes, the remaining boxes display the correct dates. Im not sure what I can do to fix this. 

Also, would anyone know how to write a script that will display a specific day for a given week. For example: If the original starting week is week ending 5/11/24, could i get boxes to display the dates for monday, tuesday, wednesday, etc in designated boxes? 

Thank you

This topic has been closed for replies.
Correct answer try67

Check the fields calculation order.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 15, 2024

Check the fields calculation order.

ninjashayAuthor
Participating Frequently
May 15, 2024

Thank you! That fixed my calcualting error! Would you know what script to use in order for me to calculate the date for each day of the week when given a week ending date?

try67
Community Expert
Community Expert
May 15, 2024

Same thing, just deduct days. If the date given is a Sunday, for example, use this to get the Friday before it:

date.setDate(date.getDate() -2);