These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

number of (referring to) instances of a subform trailer

watson23
Registered: Mar 25 2008
Posts: 37

Hi there,
I've got a table spanning over many pages & I added a subform containing a button as a trailer to that table. I'd like the number of the instances of the trailer to be shown in a text field but even more I'd like to have the possibility to refer to the button contained in all instances of the trailer subform (e.g. to control it's presence property). So far it's not a problem as long as only the last instance of the trailer is concerned but I'd like to apply changes to all the instances simultaneously.
I'd be really grateful for any help
Regards
T.M.

My Product Information:
LiveCycle Designer, Windows
MrFlow
Registered: Sep 7 2006
Posts: 13
I'm not sure if I understand everything. I created an example with a button add and remove for every row in the table. There is also a number column. The numbers will change automaticly when inserting or deleting a row.
Very important is to remerge the Form-DOM.

[b]Add Button:[/b]
var lfdNr = this.parent.parent.index + 1;
var zwWert = new Number(0);
var iManager = this.parent.parent.instanceManager;

//insert new row behind last position
iManager.addInstance(1);
//if the new row is at the end of table, you do not need to move it
if (iManager.count-1 != lfdNr)
//move the inserted row under the pushed button
iManager.moveInstance(iManager.count-1, lfdNr);

//renumber
for (lfdNr = iManager.count-1; lfdNr > this.parent.parent.index; lfdNr--)
{
zwWert = lfdNr + 1;
xfa.form.form1.P1.Sub_Dyn.tab.resolveNode("Row["+lfdNr+"]").No.rawValue
= zwWert.toString();
}

//Update Form-DOM
xfa.form.remerge();

[b]Remove Button:[/b]
var pos = this.parent.parent.index;
var zwWert = new Number(0);
var iManager = this.parent.parent.instanceManager;

//if there are more rows than the minimal count of them
if (iManager.count > this.parent.parent.occur.min)
{
//delete row
iManager.removeInstance(pos);

//renumber rows
for (var lfdNr = iManager.count-1; lfdNr >= pos; lfdNr--)
{
zwWert = lfdNr + 1;
xfa.form.form1.P1.Sub_Dyn.tab.resolveNode("Row["+lfdNr+"]").No.rawValue = zwWert.toString();
}

//Update Form-DOM
xfa.form.remerge();
}

You need to customize the reference of the field xfa.form...

Ciao
Jens