Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How do I set a subform to repeat based on a value chosen from a dropdown list?

Avatar

Former Community Member

Please forgive me if this is covered somewhere, but I have spent a few hours searching and have not come up with anything.

I have a dropdown list that allows the user to select the number of teams registering (1-5). I then have a subform with all the information needed for each team. I would like the subform to automatically repeat based on the number selected from the dropdown, since I need that information for each of the teams registering.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 7

In the exit event of the dropdown, in formcalc, put something like:

var teams = $.rawValue

var counter = 1

while (counter < teams) do

Subform2.instanceManager.addInstance()

counter = counter + 1

endwhile

this assumes you already have 1 version of the subform. If you are starting with none make the while condition (counter <= teams)

View solution in original post

3 Replies

Avatar

Correct answer by
Level 7

In the exit event of the dropdown, in formcalc, put something like:

var teams = $.rawValue

var counter = 1

while (counter < teams) do

Subform2.instanceManager.addInstance()

counter = counter + 1

endwhile

this assumes you already have 1 version of the subform. If you are starting with none make the while condition (counter <= teams)

Avatar

Former Community Member

Hi BloodyCool,

Could you please try adding the followign line on the exit event of your dropdown field?

xfa.resolveNode(Subform2.).instanceManager.count = valueFromDropdown ;

Note : valueFromDropdown is the number choosen in dropdown field.

Thanks,

VJ.

Avatar

Level 10

This is the route I'd go, no point in using a loop when you can set the count value explicitly.