Spawned form calculates from the first form

New Here ,
Nov 01, 2018 Nov 01, 2018

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

140

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 01, 2018 Nov 01, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 02, 2018 Nov 02, 2018

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines