Copy link to clipboard
Copied
When I use the spawn script to add another form (Template) to fill, my auto calculate on the next form calculates from the first and it won't calculate the entries in the form I've spawned. How do I get the next form to calculate what's entered in that form?
var expTplt = getTemplate("Form Template"); expTplt.spawn(numPages,true,false);
Copy link to clipboard
Copied
The "true" in
expTplt.spawn(numPages,true,false);
Tells Acrobat to rename your fields but I'll bet that your calculations contain string literals which means that the spawned fields are referencing the fields they were spawned from rather than the field on the same page.
There a number of different ways to solve this problem and a quick search on this forum will show you a number of different approaches.
Copy link to clipboard
Copied
See A Lesson in Templates to see how fields are renamed. When creating a PDF form that spawns new pages from templates, I create the template and then spawn the first page from the template with the script code and rename the fields. I then change the name of all the fields on the spawned page from "P1" to "P0" and then hide the template.
Using JavaScript it is possible to locate the "P#", and the template name the page was spawned from, so one can calculate the character string for the field names.