Expand my Community achievements bar.

Repeating subforms issue

Avatar

Former Community Member
I am trying to add a repeating subform, but the page ends right after the first instance. So, when I preview and add another instance of the subform, most of the content is not getting displayed. Can anyone please help? I pasted this subform on a new page and it did, indeed, add new subforms. However, when the page ends, so does the ability to have more instances of the subform.

A second issue is that the button to subtract added subforms does not show up when I add a new subform from the preview. I have checked the code. I used the buttons from the PurchaseOrder.xdp sample. Thanks for any hints!

Suzanne
3 Replies

Avatar

Former Community Member
Suzanne,



Your repeating subform must be contained in a 'Flowed" object. In addition, this parent flowed object must have the "Allow Page Breaks within Content" checkbox checked. Both of these are on the same tab in the Properties Panel.



You can wrap your subform in a subform, and make the wrapper subform Flowed with page breaks allowed.



With regards to the button, to use the code in the Purchase Order example to remove an instance, if your button lies outside the repeating subform or tablerow you will have to use the appropriate reference syntax--you will need to include the parent:



Using JavaScript(make sure you have the Scripting panel set to JavaScript) the Script goes in the button's "click" event and would include the reference syntax:



parent._repeatingChild.instanceManager.removeInstance(this.parent.index)

xfa.form.recalculate(1);

Avatar

Former Community Member
Suzanne,



I think this may be a little clearer:



parentSubform._repeatingChildSubform.instanceManager.removeInstance(this.parent.index)

xfa.form.recalculate(1);

Avatar

Former Community Member
Thanks, Stephen!

I do have my subform wrapped in a flowed parent subform and have the allow pagebreaks box checked. It just isn't working.

I don't know how to fix that code. For the add button (which works), I have the following:



form1.ConnectorInfo.FlowedSF.PropOptionsSF.Button2::click - (JavaScript, client)

// Get the instance manager.

var oManager = this.resolveNode("PropOptionsSF").instanceManager;



// Invoke the Instance Manager to add one instance of the detail subform.

var oNewInstance = oManager.addInstance(1);



// Invoke the Instance Manager to insert the subform below the current one.

var nIndexFrom = oNewInstance.index;

var nIndexTo = this.parent.index + 1;

oManager.moveInstance(nIndexFrom, nIndexTo);



For the subtract button, which never appears, I have the following:



form1.ConnectorInfo.FlowedSF.PropOptionsSF.Button1::click - (JavaScript, client)

// Get the instance manager.

var oManager = this.resolveNode("PropOptionsSF").instanceManager;



// Invoke the Instance Manager to remove the current instance of the detail subform.

this.resolveNode("PropOptionsSF").instanceManager.removeInstance(this.parent.index);



See any obvious problems here?

Thanks again!

Suzanne