Copy link to clipboard
Copied
Hello, I tried and now I need help with an application I am building...
I have a button that can produce spawned hidden page tenplates via the Javascript action, but when I do with the same feature on the same hidden page, it retains the field names and data. Is there a way to produce the same hidden pages multiple times, but automatically changed the field data names in the new page so copied data doesn't duplicate?
Or must I create a duplicate template for each possible click and change the names myself?
Or is there a way to duplicate the page directly without merging the field names (thus, creating new field data).
Here is the code I use for the spawning of the hidden template:
var a = this.getTemplate("EmploymentPage");
a.spawn(this.pageNum+1,true,false);
this.calculateNow();
Just trying to save some time here.
Thanks in advance 🙂
Copy link to clipboard
Copied
You must use the bRename method (set to true):
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#template
Copy link to clipboard
Copied
Rename is set to true in your script, so it should rename fields. Can you share your file with us?
Copy link to clipboard
Copied
I have to get permission from our corporate management, but will do if can unless I have a solution sooner.
Thanks!
Copy link to clipboard
Copied
I got it worked out (see my response to correct answer) so no need to share file. Thanks!
Copy link to clipboard
Copied
You can avoid this when you spawn the page at the end of the document:
a.spawn(this.numPages,true,false);
Or spawn the page after already spawned pages.
Copy link to clipboard
Copied
Sadly, the spawned pages have to be in the middle of the application (which there are three instances where that happens for three different pages). But that's good to know. Thanks!
Copy link to clipboard
Copied
You must use the bRename method (set to true):
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#template
Copy link to clipboard
Copied
Thanks, after much trial and error (kind of new to Javascript), I got it right.
Here is what I did,
var a = this.getTemplate("EmploymentPage");
a.spawn({nPage:this.pageNum+1, bRename:true, bOverlay:false});
this.calculateNow();
Works beautifully!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now