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

Copying specific Form fields from one page to another based on specific date field

New Here ,
Apr 10, 2025 Apr 10, 2025

Hello! I am trying to create a sales tracker for a commisson based job. I'm wanting to be able to have a date field that when I choose a date, it will take the information from a previous page in the form and insert into a table. For example, if I choose January 5th in the date field, I would like it to copy the sales and tips fields from a previous page into new fields underneath the date on a different page. Is there a simple way to do this? Thanks in advance for your help!

TOPICS
Create PDFs , How to , JavaScript , Modern Acrobat , PDF , PDF forms
347
Translate
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 Employee ,
Apr 10, 2025 Apr 10, 2025

Hi @DarthShayder,

 

Hope you are doing well. Thanks for writing in!

 

What you're trying to do is definitely possible, but it does require a bit of JavaScript to make it dynamic, since forms don’t natively support “auto-populating tables based on a date selection” out of the box.

 

Here's something you can try:

 

Ensure your fields are named in a way that makes scripting easy. For example:

  • Page 1:

    • sales_0105 (for Jan 5 Sales)

    • tips_0105 (for Jan 5 Tips)

  • Page 2:

    • date_select

    • sales_output

    • tips_output

You can add a custom script to trigger when the date_select field is modified.

 

Here’s a sample script:

 

var dateStr = this.getField("date_select").value;

// Convert date to MMDD format
var dateObj = util.scand("mm/dd/yyyy", dateStr);
if (dateObj !== null) {
    var month = (dateObj.getMonth() + 1).toString().padStart(2, "0");
    var day = dateObj.getDate().toString().padStart(2, "0");
    var key = month + day;

    // Get values from Page 1
    var salesValue = this.getField("sales_" + key).value;
    var tipsValue = this.getField("tips_" + key).value;

    // Populate fields on Page 2
    this.getField("sales_output").value = salesValue;
    this.getField("tips_output").value = tipsValue;
}

 

Here's how to add the script:

 

  • Open your form in Acrobat.

  • Select the date_select field.

  • Go to Properties (right-click → Properties or use the Prepare Form tool).

  • Go to the "Actions" tab.

  • Choose:

    • Trigger: On Blur (or On Focus Lost)

    • Action: Run a JavaScript

  • Click Add... and paste the script above.

  • Click OK and save your form.

 

Hope this helps.


Regards,
Souvik.

Translate
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 ,
Apr 10, 2025 Apr 10, 2025

I believe this response may have come from ChatGPT or a similar AI platform. While AI-generated answers can sometimes be helpful, they aren’t always accurate—especially when it comes to specific environments like Acrobat JavaScript.

As an Adobe employee, it's important to note that the padStart() method is not supported in Acrobat's JavaScript engine, which is based on an older ECMAScript version.

Translate
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 ,
Apr 10, 2025 Apr 10, 2025

Name the fields on both pages identically.

Translate
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 ,
Apr 10, 2025 Apr 10, 2025

Does date matter, or you just want to copy field values to new fields when you select date?

Translate
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 10, 2025 Apr 10, 2025

The dates matter. I want my co workers to be able to use it as well, but we all prk different days. I also don't want to have to go back and redo it each year.

Translate
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 10, 2025 Apr 10, 2025

Sorry, let me explain it a bit better. I want to have a chart that shows the totals for the 4 or 5 days they worked, and then at the end of the "week" they can see what their totals are, and on pay weeks, see their estimated paycheck. So, day by day they'll have how much each sale is and any tips, with daily totals on those days, but then toward the end of the document, it'll show their monthly view of total sales and tips for the days they worked, with the end of the week showing the weekly total. If I need to upload a screenshot I can.

Translate
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 ,
Apr 11, 2025 Apr 11, 2025

Yes, please do, or share the actual file.

Translate
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 11, 2025 Apr 11, 2025

Here's the file.

Translate
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 ,
Apr 11, 2025 Apr 11, 2025

Since there are so many fields in your file I would recommend against doing it automatically. You should use a button that when clicked collects all the data from the calendars and copies it to the summary pages at the end of the page. Otherwise you will have serious delays each time the user enters anything into any of the fields.

Translate
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 11, 2025 Apr 11, 2025
LATEST

That makes sense. I was kinda thinking that's what the date button could do. So if I were to add a date field to choose January 3rd, it would trigger something that would copy the "Totals" fields to the labeled area underneath it. Some coworkers only work 4 days, and they work some Saturdays, so I want them to be able to have accurate dates for their tracker at the end.

Translate
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 ,
Apr 11, 2025 Apr 11, 2025

It is still not clear to me exactly what you are trying to accomplished.  Where will the the date field be, or are you going to have buttons for each day on the page 1 calendar.  Can you please provide a specific example.  What data should go where when what happens.  "Is there a simple way to do this?"  Probably not.  But it looks like you took a lot of time manually naming your fields.  At first glance of the field names I spotted a couple of errors in the pattern.  It would've been a lot easier to to create one row of field and use right-click > Create multiple copies to get field names with numbered suffixes, or run a script to place your fields programatically.  It takes some thought in field naming for a project like this and then a written function in a document level script that you call in the fields that will trigger what you want to occur.  This might help:

https://pdfautomationstation.substack.com/p/anticipating-field-names-in-custom

Translate
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