Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

passing field data from a repeating subform to another repeating form

Avatar

Level 4

Hi all,

In my main form, I have a repeating subform which captures various customer demographics. It repeats up to 7 instances based on how many clients are associated to a particular account.

The form user clicks a button to add new instances then fills in the various fields.

What I have currently is another hidden subform which I need to then make visible, but I also need one new instance of that form, prefilled with selected fields, for each instance of the first subform.

I'm not sure how to go about doing this. Based on my searches, it appears I need some sort of script to resolve each node and associate it with the second subform instances but I'm really unclear how to do that.

Any advice will be greatly appreciated! TIA

0 Replies

Avatar

Level 4

Hi all,

I thought I found what I was looking for but still having problems getting it to work. Found this example on John Brinkman's blog...

 

var srcFields = Subform1.resolveNodes("$.#field[*]");

for (var i = 0; i < srcFields.length; i++) {

  var fieldName = srcFields.item(i).name;

  // if the same-named field exists in S2…

  if (Subform2.nodes.namedItem(fieldName)) {

     Subform2[fieldName].rawValue = srcFields.item(i).rawValue;

  }

}

I created a simple form containing 2 flowed subforms, each with one text field (same name). I added a button to subform1 to add one instance of subform1 on each click. I placed the script above in the change event of the text field in subform1.

Nothing is happening at all in subform2. I can add my 3 instances, enter a name in the text field but nothing shows up in the text field of subform2.

Can anyone offer any suggestions? Very new to this stuff so I'm really at a standstill. TIA!

Avatar

Level 4

OK...I think I may know why this example isnt working but not sure how to correct the script. I think the structure on my form differs from the sample.

Hope i explain this accurately.

Flowed subform1

   Positioned repeating form

          textfield

          button

Flowed subform2

   Positioned repeating form

          testfield

Avatar

Level 4

Ok, so it does something but not what it is supposed to based on JB's blog. The code above was in the exit event of my repeating text field. I added a checkbos to subform1 and put the script in the click event of the checkbox.

I added my 3 instances of the subforms, filled in the textfields in subform1 and then clicked the checbox.

Only the first instance of the textfield in subform2 gets filled in....it also is the text from the last textfield entered.

Any ideas?

Avatar

Level 4

I seem to be my own worst enemy....OK so in going through yet again, I do think it is doing what is supposed to do. Simply copy like named fields from one subform to another.

This helps a little.

The problem is I need some way to get like named fields in repeating subforms, to copy to a second set of repeating subform.

Impossible? If not, any suggestions on how to accomplish this?

I think my head is going to explode, I've been trying to solve this off and on since I started working with Livecycle this summer.