Populate fields of a spawned template

Engaged ,
May 22, 2018 May 22, 2018

Copy link to clipboard

Copied

I tried populating the fields of a spawned template right from the spawn button but it seems like the fields of the template remain inexistant until the script ends.

I have 60 pairs of fields containing a person and an account balance.  Upon spawning, I need only to list all the people with a positive balance in a field (a simple string) then deduct 5$ from the balance

var a = this.getTemplate("groupe")

a.spawn()

var aParticipants = []

for (var mySolde=0;mySolde<=59;mySolde++){

if (this.getField("solde."+mySolde).value >= 5){

this.getField("solde."+mySolde).value -= 5

aParticipants.push(this.getField("membres."+mySolde).valueAsString)

}

}

//Show participants

var prefix = "P"+this.numPages

var group0 = this.getField(prefix+".groupe.list.0")

for (i in aParticipants){

group0.value += aParticipants+"\n"

}

How can I add values to my newly spawned page's fields?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

87

Likes

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
Engaged ,
May 22, 2018 May 22, 2018

Copy link to clipboard

Copied

LATEST

The first part of the script works fine but the second part returns an error as if it can't find the field on the spawned page

Likes

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