Skip to main content
Participating Frequently
November 1, 2018
Question

Spawned form calculates from the first form

  • November 1, 2018
  • 2 replies
  • 545 views

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);

This topic has been closed for replies.

2 replies

Inspiring
November 2, 2018

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.

Joel Geraci
Community Expert
Community Expert
November 1, 2018

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.