Autofill Dates

New Here ,
Feb 11, 2022 Feb 11, 2022

Copy link to clipboard

Copied

Capture.PNG

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!

TOPICS
General troubleshooting , How to , PDF forms

Views

144

Likes

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

correct answers 1 Correct answer

Adobe Community Professional , Feb 11, 2022 Feb 11, 2022

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

...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 11, 2022 Feb 11, 2022

Copy link to clipboard

Copied

What date format you are using?

Should it fill for next week or previous week?

Likes

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 ,
Feb 11, 2022 Feb 11, 2022

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!

Likes

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
Adobe Community Professional ,
Feb 11, 2022 Feb 11, 2022

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.

Likes

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 ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

This worked perfectly! Thank you so much!!!!

Likes

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 ,
Apr 17, 2022 Apr 17, 2022

Copy link to clipboard

Copied

this worked amazing for me !!!

Likes

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 14, 2022 Jul 14, 2022

Copy link to clipboard

Copied

LATEST

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

 

Likes

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