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.

Populating dropdown list from multiple instances of another dropdown lists

Avatar

Level 1

Hi everybody.

I have 3 dropdown lists which could have several instances (The user determines how many instances there will be). Then I have another dropdown list which could have several instances and which should be populated based on inputs from previous 3 dropdown lists. How can I write the addItem for the 4th dropdown list to grab the data from all the instances of the previous dropdown lists? Many thanks in advance

Example:

Dropdown list 1: Instance 1: Item 1

Dropdown list 1: Instance 2: Item 1

Dropdown list 1: Instance 3: Item 2

Dropdown list 2: Instance 1: Item 3

Dropdown list 2: Instance 2: Item 4

Dropdown list 2: Instance 3: Item 2

Dropdown list 3: Instance 1: Item 5

Dropdown list 3: Instance 2: Item 6

Dropdown list 3: Instance 3: Item 7

Dropdown list 4: Instance 1: Item X (User is able to choose from Item 1,2,3,4,5,6,7)

Dropdown list 4: Instance 2: Item Y (User is able to choose from Item 1,2,3,4,5,6,7) etc

1 Reply

Avatar

Level 1

After some searching I´ve been able to draft the code, however it still doesn´t work.

Any help or suggestion would be appreciated.

this.clearItems();

this.rawValue = null;

var nCount = sDetails.Dropdownlist1.Row2.instanceManager.count;

var nCount2 = sDetails.Dropdownlist2.Row2.instanceManager.count;

for (var i=0; i<=nCount; i++)

{

     var vFld = xfa.resolveNode("sDetails.Dropdownlist1.Row2[" + i + "]");

     var vObj = vFld.Item1.rawValue;

    if (vObj != null){

             this.addItem(vObj); }

}

for (var i=0; i<=nCount2; i++)

{

     var vFld2 = xfa.resolveNode("sDetails.Dropdownlist2.Row2[" + i + "]");

     var vObj2 = vFld2.Item2.rawValue;

     if (vObj != null){

             this.addItem(vObj2);

         } 

}