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

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

855

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

Community Expert , 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

...

Votes

Translate

Translate
Community Expert ,
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?

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 ,
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!

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
Community Expert ,
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.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

this worked amazing for me !!!

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

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

 

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 ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

i have same question here

hope she reply

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
Community Expert ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

LATEST

To populate fields with increment days, you can use this as validation script of "Date1" field:

var date = util.scand("mm/dd/yyyy", event.value);
for( var i=2; i<=7; 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);}}

 

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