Populate fields with unique values from form entries
I have a form that users are to enter their initials or ID# after each step is complete. There can be several users completing this form leading to several unique entries. At the end of the form the users will print the document and physically sign their name next to their initials. I'm trying to figure out how to have the initials automatically populate next to a signature box.
I've created a field hierarchy called Init "Init.10, Init.11,... " to enter initials for each job step and fields at the end of the form to put the initials/ID#'s (see below).

I've been able to use the following code I found to iterate through the "Init" fields and display the values but it only displays the first value it sees. I'm thinking I need to have the values put into an array and put the first initial into the "Initial.A" field then use an if-else statement to check the contents of the array against "Initial.A" and if it matches go to the next element in the array and place that in "Initial.B" and repeat. If that's correct I'm having trouble seeing how to do that.
I played with pushing the aNames.value to the arr array and setting arr[0] equal to Initial.A but it didn't work. Any suggestions or guidance would be helpful.
Thanks,
Bill
var oNames = this.getField("Init");
var arr = [];
// get array or terminal children
var aNames = oNames.getArray();
this.getField("Sig").display = display.hidden;
// walk the tree:
for(i in aNames) {
if(aNames[i].value != "") {
this.getField("Sig").display = display.visible;
this.getField("Initial.A").value = aNames[i].value;
}
}
