• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

337

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
Community Expert ,
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.

Votes

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

LATEST

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.

Votes

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