Skip to main content
Inspiring
March 19, 2025
Answered

How to edit autofilled fields?

  • March 19, 2025
  • 2 replies
  • 944 views

Hi!

 

I have a two-page fillable PDF, 1st page is the quote, 2nd page is the finished work order.

 

When the user fills in the 1st page, I need the duplicate fields on the 2nd page to autofill but I need that autofilled text on the 2nd page to be editable and if edited it needs to leave the text on the 1st page intact.

 

I know that I can name the duplicate fields the same so that FIELD01 on the 2nd page will autofill when FIELD01 on the 1st page is filled in (and vice versa) but when the text in either of the two fields is changed, it changes in both.

 

What would I need to do to accomplish this? Would it require specific javascript or is there a way to manage this from the Properties? I hope that all makes sense.

 

Thank you so much!! 🙂

Correct answer PDF Automation Station

Instead of naming the fields identically, or using a custom calculation script on the page 2 fields that reference the page1 fields, use a custom validation script on the page 1 fields.  Here's an example:

this.getField("Page2Text").value=event.value;

Whenever the field value of the field containing this script changes it will automatically populate the field called Page2Text with the same data.  The Page2Text field will be editable and will not change the value of the original field when it is changed.  Some articles for your reference:

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts-eb5

https://pdfautomationstation.substack.com/p/another-method-for-calculation-vs

2 replies

Participating Frequently
March 19, 2025

I have accomplished something similar with this simple field level customer calculation script.

if(this.getField("CheckBox1").value == "Yes" ) event.value =   this.getField("FIELD01").value

 

//note that this field is named something different, such as FIELD01a.  I have the checkbox defaulted to yes, and when I uncheck the box, I can edit the import field.   If you recheck the box, it will revert back to the data input information.   There may be an easier or more elegant way, but I am not a programmer and only know limited javascript.

Inspiring
March 19, 2025

Hi! Thank you! You are ahead of me for sure, lol. I don't have a checkbox and I'm not sure that I'll be able to dissect your script to do what I need but I'm going to try. Thank you again. 🙂

PDF Automation Station
Community Expert
Community Expert
March 19, 2025

Instead of naming the fields identically, or using a custom calculation script on the page 2 fields that reference the page1 fields, use a custom validation script on the page 1 fields.  Here's an example:

this.getField("Page2Text").value=event.value;

Whenever the field value of the field containing this script changes it will automatically populate the field called Page2Text with the same data.  The Page2Text field will be editable and will not change the value of the original field when it is changed.  Some articles for your reference:

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts-eb5

https://pdfautomationstation.substack.com/p/another-method-for-calculation-vs

Inspiring
March 19, 2025

Hi, and thank you! 🙂

 

On the 1st page, FIELD01 is a calculation result of other fields. Also in FIELD01, on the 1st page, I currently have the following custom validation script:

 

var f = this.getField("FIELD01");
f.hidden = (event.value < .0000001);

 

Replacing Page2Text in your script with FIELD01_COMPLETION (which I think would look like the following):

 

this.getField("FIELD01_COMPLETION").value=event.value;

 

How would I combine the two scripts? Is it possible?

 

Thank you again so much!

PDF Automation Station
Community Expert
Community Expert
March 19, 2025

Leave your script and enter mine as a validation script.