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

Dates and Days Autofill

Community Beginner ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

I have an excel that lets me enter a date, and it autofills the highlighted areas with the date end rage of 2 weeks from the initial date entered. It autofills the dates next to the days. I am new to Acrobat, but need to redo our timesheet as a fillable PDF instead of using Excel. Please help!

 

 

Adobe Date Fields.PNG

TOPICS
Create PDFs , Edit and convert PDFs , How to , PDF forms

Views

1.0K

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 , Sep 21, 2021 Sep 21, 2021

Lets say your field names are "Date1-Date14", use this as validation script of "CalendarMain" field (field where you select start date):

var date = util.scand("mm/dd/yyyy", event.value);
for( var i=2; i<=14; i++){
if(event.value == ""){
this.getField("Date1").value = "";
this.getField("Date"+i).value = "";}
else {
date.setDate(date.getDate() +1);
this.getField("Date1").value = event.value;
this.getField("Date"+i).value = util.printd("mm/dd/yyyy", date);}}

Votes

Translate

Translate
Adobe Employee ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

Hi there

 

Hope you are doing well and sorry for the trouble.

 

The workflow you are trying to do is might be possible using the custom JavaScript. For more information about using the Javascript please check the help page - https://acrobatusers.com/tutorials/javascript_console/

 

Regards

Amal

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
Enthusiast ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

You don't have fields where dates should go?

Do you want first date to be same as input date or it starts with +1 day?

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 Beginner ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

Yes, the first day would be the date entered. Below is our current sheet. When you enter a date in the "FROM" cell, it will autofill the rest of the dates shown. 


default5xve0pz6697v_0-1632253684436.png

 

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 ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

Lets say your field names are "Date1-Date14", use this as validation script of "CalendarMain" field (field where you select start date):

var date = util.scand("mm/dd/yyyy", event.value);
for( var i=2; i<=14; i++){
if(event.value == ""){
this.getField("Date1").value = "";
this.getField("Date"+i).value = "";}
else {
date.setDate(date.getDate() +1);
this.getField("Date1").value = event.value;
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
Community Beginner ,
Sep 22, 2021 Sep 22, 2021

Copy link to clipboard

Copied

This worked! This has been extremely helpful! I have seen you post on other pages and i appreciate you taking the time, yet again, to assist a novice. 

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 Beginner ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

This works great! However, we enter the last day of the pay period instead of the first day. How would I change the script for that? Thanks!

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 ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

LATEST

Change:

date.setDate(date.getDate() +1);

To:

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

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