Skip to main content
Inspiring
May 22, 2018 7:30 PM UTC
Question

Populate fields of a spawned template

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?

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
May 22, 2018 7:31 PM UTC

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

Translate