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?
Copy link to clipboard
Copied
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