Skip to main content
Participating Frequently
August 5, 2020
Answered

Duplicate Form Not Refreshing Fields But Third Form Is. How Do I Get The Second Form to Clear Data

  • August 5, 2020
  • 1 reply
  • 2717 views

Hello, I'm new here and new to Acrobat. I have successfully added a button to a form I want to duplicate and it is duplicating the form correctly. This issue I'm having is that I've added a batch Rename in the javascript but it's only taking effect on the third page generated. The page that's generated after the first button press is a direct copy of the original(fields and all), but the button on the newly generated form produces a clean form with empty fields. How do I get my original form button to produce a clean form with empty fields on the first duplication of the form?

This topic has been closed for replies.
Correct answer try67

I appreciate it. What I would really like to do is retain the info on the original form and spawn a new and clean form duplicate so the client can stack as many benefit pages as necessary. Is there another way to achieve this? I've attempted a reset form function after the new form is spawned but it clears the original form as well. Any ideas? What would be the programmatic approach? Thank you again.


You can hide the template page and then spawn copies from it as needed. The fields on the hidden page will remain empty, and therefore so will be the new ones you create.

 

The programmatic approach to resetting just the new fields would be to look at the their page property, since you know what's the page number of the spawned page, so you can reset only those fields.

1 reply

Bernd Alheit
Community Expert
August 5, 2020

What script does you use at the button?

Participating Frequently
August 5, 2020

var pageCount = 0;

var pagePos = 0;

pageCount = this.numPages;

pagePos = pageCount-2;

var b = getTemplate("Add Benefit");

b.spawn({nPage: pagePos, bRename: true, bOverlay: false});

Bernd Alheit
Community Expert
August 6, 2020

I've been trying to get the hidden template function to work but I must be missing something. If I set the document as hidden, then go to preview, it doesn't operate any differently and when I go back to Organize Pages, the box is checked because it's not hidden. I then dragged and dropped a new thumbnail copy of the original document and set the first copy to hidden. It disappears from view and I still have the original document but in testing, the behavior is the same. I then duplicated the page with all new field names and set the original page with the default names as the hidden template, and now all fields match the original blank document I set to hidden(all forms that were filled out are now blank). I feel like there must be something in my javascript that is not working with the acrobat settings and there is some type of conflict. I am new to this and feel like I cultivated a more complicated situation. Any help is very welcome. Thank you. I'm new


Open the document with the one page. Add a empty page. Hide the template page. Spawn the template page in the Javascript console. Delete the empty page. Save the document.