Copy link to clipboard
Copied
Hello! I am creating a time sheet for my law firm that was previously an Excel. The clerks would just make a copy every week and fill it out. We are switching over to Adobe Form. How can I design it to where when someone puts the Sunday date at the top as the "Week Ending", it will autofill the other dates. I've tried a couple of solutions I found on here but nothing has worked. Thank you in advance!
So the last date "Date7" (Sunday) is same date as the one you fill on top?
Try this script as 'Validation' script of "Date" field and see if it needs to change anything:
var date = util.scand("mm/dd/yyyy", event.value);
for( var i=6; i>0; i--){
if(event.value == "")
this.getField("Date"+i).value = "";
else {
date.setDate(date.getDate() -1);
this.getField("Date"+i).value = util.printd("mm/dd/yyyy", date);}}
this.getField("Date7").value = event.value;
Also you didn't say what date format you used so I
...Copy link to clipboard
Copied
What date format you are using?
Should it fill for next week or previous week?
Copy link to clipboard
Copied
So I have them input Sunday at the top (which is the last day of our pay period) so it should fill in the previous week!
Copy link to clipboard
Copied
So the last date "Date7" (Sunday) is same date as the one you fill on top?
Try this script as 'Validation' script of "Date" field and see if it needs to change anything:
var date = util.scand("mm/dd/yyyy", event.value);
for( var i=6; i>0; i--){
if(event.value == "")
this.getField("Date"+i).value = "";
else {
date.setDate(date.getDate() -1);
this.getField("Date"+i).value = util.printd("mm/dd/yyyy", date);}}
this.getField("Date7").value = event.value;
Also you didn't say what date format you used so I used "mm/dd/yyyy" you can change it to whatever you need.
Copy link to clipboard
Copied
This worked perfectly! Thank you so much!!!!
Copy link to clipboard
Copied
this worked amazing for me !!!
Copy link to clipboard
Copied
Hi, Nesa!
I just sent you a message. This is the similar situation I was referring to in my message. I am needing to start at the top (Monday) and it auto fill moving ahead in sequential order through 7 days - Monday-Sunday.
Monday = 04/01/2022
Tuesday = 04/02/2022
Wednesday = 04/03/2022