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

SOLVED

How to add a set number of instances based on number selected from a drop down

Anonymous
Not applicable

I have a form where I would like users to be able to select a number from a drop down, and that number of instances of a specific subform get displayed, eg if they select 3 from the drop down, 3 instances of the subform display. I'm a LiveCycle newbie, so can anyone help me with a simple way to do this?

1 Accepted Solution
Magus069
Correct answer by
Level 10
Level 10

When a row is hidden when the form is created and you add instances of that row, it will add these rows as hidden because it is using the initial properties of the row.

You would have to set every rows which have been added to visible when they are created.

subform1.instanceManager.setInstances(5);

for (var i = 0; i < subform1.instanceManager.count; i++){

     var frmSub = Main.resolveNode("subform1[" + i.toString() + "]");

     frmSub.presence = "visible";

}

View solution in original post

4 Replies
Magus069
Level 10
Level 10

to do so you can use the setInstances() method

subform1.instanceManager.setInstances(2);

if you want to make the number of instance out of a selection in a dropdownlist you can use its value to set the instances

subform1.instanceManager.setInstances(dropdownlist.rawValue);

Anonymous
Not applicable

Thanks Magus069, this works for me fine if the original instance of the subform is set to visible, but not when it is hidden (as I would want it to be in this form). Any suggestions for how to get around this?

Magus069
Correct answer by
Level 10
Level 10

When a row is hidden when the form is created and you add instances of that row, it will add these rows as hidden because it is using the initial properties of the row.

You would have to set every rows which have been added to visible when they are created.

subform1.instanceManager.setInstances(5);

for (var i = 0; i < subform1.instanceManager.count; i++){

     var frmSub = Main.resolveNode("subform1[" + i.toString() + "]");

     frmSub.presence = "visible";

}

View solution in original post

Anonymous
Not applicable

Thanks you so much. A little tweaking and I've got it working exactly how I want it now. Cheers.