Still struggling with this but I have found some code that is making me think I am close.
My thought for the code below is to have click event
- check the number if instances in a subform
- create that exact amount of instances in another subform
- copy the contents of the first subform instances into an array
- paste the contents of this array in the new instances.
// on click vent
// create new empty array
var ofirstArray = [];
for (var i = 0; i < _nameSubform1.count; i++) // this is the total number of instances in nameSubform1 ...
{
// get a reference to the nameSubform1[i] object
var oSub1 = this.resolveNode("nameSubform1[" + i + "]");
// set the value of its textfield object
oSub1.textField.rawValue = ofirstArray[]; // fill this array with the contents of the instanced text field within nameSubform1
}
// now that we have the array filled paste the contents
// into a new subform with the same number of instances
_nameSubform2.setInstances(x); // x should be equal to _nameSubform1.count
for (var i = 0; i < _nameSubform2.count; i++) // this is the total number of instances in nameSubform2...
{
// get a reference to the nameSubform2[i] object
var oSub2 = this.resolveNode("nameSubform2[" + i + "]");
// set the value of its textfield object
oSub2.textField2.rawValue = ofirstArray[i]; // fill these text fields with the contents of the array created above from nameSubform1
}
I just confused myself there...I'm thinking now I can do it all in one for loop. I need help.