Multiple repeating SubForms binding to the same data node | Community
Skip to main content
February 28, 2013
Question

Multiple repeating SubForms binding to the same data node

  • February 28, 2013
  • 14 replies
  • 14251 views

Having multiple repeating SubForms binding to the same data node : In our documents, many times we need to display information from same table in multiple locations. For example, if document displays information of Insureds on one page and information of drivers on another page, we need to create a LiveCycle document with two SubForms. Each SubForm needs to have a repeating binding to CommonInsured element in XSD.  LiveCycle Designer is not able to handle such case. We cannot have two subforms bound to the same node, ONLY in a case where repeating option is selected for data binding.

The only way I have found out is the following Javascript

//Get the data node from XML. You will find the code for this function in //JavaHelperFunctions library.

// InsuredDataRepeatingSubForm is a second subform.

//You need to manually add instances to this subform at the

//runtime and Insured data to each instance.

var insuArray = JavaHelperFunctions.getInsureds();

    var i=0;

    for( i=0; i<insuArray.length; i++)

    {

       if (i>0)

       {

var thesubform = this.InsuredDataRepeatingSubForm.instanceManager.addInstance(i);

              thesubform.InsuredName.rawValue = insuArray[i].fullName.value;

       }  

       else

       {

               this.InsuredDataRepeatingSubForm.InsuredName.rawValue = insuArray[i].fullName.value;

       }

    }

Is there any way I can achieve directly using bindings since we are trying to minimize javascript that changes the layout of the form?

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

14 replies

_Bruce_Robertson
New Participant
November 22, 2018

Hi Jorge,

I'm not sure what you mean by work independently from each other when it comes to "binding", Do you want the details to auto-populate or are you looking for a button to optionally populate the form.

Bruce

New Participant
November 21, 2018

Hello Kyle,

I have created a subform with the ability to auto fill information in subsequent fields throughout the form (1 pager). I added an "ADD" button so that it can duplicate the form as many times as necessary for when we are doing bulk-work. The issue that I am having is that all of the information I enter in the first form will auto-populate in all subsequent "added (repeated)" forms.

I would like for each of the "added" subforms to work independently from each other when it comes to "binding", but still have the ability to auto-populate information within each form only.

how can i accomplish this?

PS: i cannot share the template as its copyrighted by my employer.

Thank you so much!!

Jorge

New Participant
July 31, 2013

Kyle,

Glad I found this thread. 

I'm doing essentially the same thing that Vanessa was doing.  Primary difference being that i'm not duplicating a table row, but a subform.

I can only get the function to work partially for me, it adds the same number of instances to the sister page, but doesn't populate those fields with the values. 

Any suggestions on where my issue might be?

Thanks

New Participant
March 27, 2013

Glad I could help.

Kyle

New Participant
March 27, 2013

I wanted to let you know it works great. Saved me a lot of trouble and work..

Thanks,

New Participant
March 13, 2013

Hi Scott,

Ya, that's what I use to do, but with subforms names changing all the time and especially when I have subforms that can have up to 7 repeatable layers in, I decided to buckle down and write a reusable function that didn't require hard coding it each time.

Kyle

New Participant
March 13, 2013

Hey there,

I answered a similar question a while back. It's safe to ignore everything and just look at the answer Most of it was just me trying to work out what exactly the OP was asking for. Let me know if the linked answer spawns any questions.

- Scott

New Participant
March 13, 2013

Oh wow! My bad. I completely forgot that the paramaters have to be instance manager class objects of your subform. (Wrote that function awhile ago).

That means myScripts.loadData(Page1.WitnessNameSubform.WitnessTable._Row1,CrossComplaint.WitnessNameSubform.WitnessTable._Row1).

Sorry for the headache Vanessa.

If you're still having issues I'd be happy to look at your form for you to figure it out.

Kyle

New Participant
March 13, 2013

I set my hierarchies the same except for the page name.... I change them both to ROR but still the same result.

source is

page1.WitnessNameSubform.WitnessTable.Row1

target is

CrossComplaint.WitnessNameSubform.WitnessTable.Row1

All object fields are named exactly the same. (I actually copied the table from page 1 and pasted it to the second page named "CrossComplaint".)

I copied and pasted the function into a script object page called myScripts.

Below is my command line to call the function.

topmostSubform.CrossComplaint.WitnessNameSubform.WitnessHeading.WitnessButton::click - (JavaScript, client)

myScripts.loadData(Page1.WitnessNameSubform.WitnessTable.Row1,CrossComplaint.WitnessNameSubform.WitnessTable.Row1)

I entered data into the source table. Clicked on the button and nothing happens.

Any ideas? Thanks again for your help.

Vanessa

New Participant
March 8, 2013

You need to call the function loadData with the source and target subforms as your parameters. For example, say you have a button that you click that transfers the data. First create a script object and name it myScripts. Copy and paste the function above into it. Then in the click event of the button you would put myScripts.loadData(sourceSubform.Row1,targetSubform.Row1) or whatever the names of your forms may be.

Alternatively you can forget creating a script object and just put the function in the button with that line of script but the purpose of functions are primarily for reuse in other objects.

Hope that makes sense. If it doesn't let me know and I can post a sample. I won't be able to until Monday though.

Kyle