I'm trying to have the value of a text field in a repeating subform (lets call it the “Identify” subform) of my form to be set to the value of “TextField18” in the corresponding subform instance of the “Groups” subform.
In more detail:
In the form I ask the question - how many groups do you have? The number for that answer is the number of instances of the "Groups" subform that I have. Within that subform is a text field ("Text Field18") where the user would enter the name of the group.
Later, in a completely different section of the same form, I have a subform called "Identify". I have figured out how to set the number of instances of "Identify" to match the number of instances of "Groups". What I would like to do is have a field in "Identify" display the name of each group (as entered in "TextField18" in the "Groups" subform) - one per instance of the subform. So if the groups were Orange, Red and Purple as entered in instances 1-3 respectively of the "Groups" subform. I would want the field in instance 1 of the "Itentify" subform to autopopulate with Orange, and the field in instance 2 to autopopulate with Red, and so on.
Is this possible? Any advice is appreciated!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Your repeating subforms, Groups and Identify, will have an index property to identify their occurance. So in the calculate event of the textfield in Identify using JavaScript place the following code;
xfa.resolveNode("Groups["+Identify.index+"].TextField18").rawValue;
This will return the corresponding value in the Groups subforms. Note you may have to adjust the SOM expression if Groups and Identify are not at the same level.
Bruce
Views
Replies
Total Likes
You access each instance of the Groups subform in formcalc by using Groups[0].TextField18, Groups[1].TextField18 etc. (remembering the numbers start at 0 not 1). So to fill your Identify fields you would do a loop with a variable to access each instance and then fill the field with the relevant instance of TextField18.
Hi,
Your repeating subforms, Groups and Identify, will have an index property to identify their occurance. So in the calculate event of the textfield in Identify using JavaScript place the following code;
xfa.resolveNode("Groups["+Identify.index+"].TextField18").rawValue;
This will return the corresponding value in the Groups subforms. Note you may have to adjust the SOM expression if Groups and Identify are not at the same level.
Bruce
Views
Replies
Total Likes
Thank you both for your help.
I'd done everything with JavaScript so far, so I tried Bruce's answer and it worked perfectly!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies