Expand my Community achievements bar.

SOLVED

Reference specific field in a repeating subform

Avatar

Level 2

Hi Everyone,

I have the following piece of code sitting within a subform which is dynamically repeated:

var TreatDate = FormName.Subform1.Subform2.RepeatedForm1.Subform3.Subform4.RepeatedForm2.Subform5.Subform6.textfield.rawValue

RepeatedForm1 can have multiple RepeatedForm2's, and there can be multiple of the RepeatedForm1's within the form Ie like the structure below:

Repeatedform1 (instance1)

     RepeatedForm2 (instance1)

     RepeatedForm2(instance2)

     RepeatedForm2(instance3)

     RepeatedForm2(instance4)

Repeatedform1(Instance2)

     RepeatedForm2(instance1)

     RepeatedForm2(instance2)

     RepeatedForm2(instance3)

     RepeatedForm2(instance4)

     RepeatedForm2(instance5)

     RepeatedForm2(instance6)

     RepeatedForm2(instance7)

My question is: how can i make use of the xfa.resolveNode() statement (or a more correct statement!) to make sure i get the value of the correct instance of Repeatedform1 & Repeatedform2 so i can correctly store the value of the textfield into the local variable?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

You should make a relative reference to the field, so probably something like

var TreatDate = RepeatedForm2.Subform5.Subform 6.textfield.rawValue

But it depends were the code is

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

You should make a relative reference to the field, so probably something like

var TreatDate = RepeatedForm2.Subform5.Subform 6.textfield.rawValue

But it depends were the code is

Avatar

Level 2

So currently the code is sitting in the OnExit event of a dropdown list, which is sitting within Repeatedform2

Avatar

Level 10

You can generate a relative reference to a form object by;

1. making sure the code editor has focus

2. hold the ctrl key down

3. Click the form object in the design view