Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

mimic populated items in a series of other fields

Avatar

Level 2

Hello all, I scripted a second drop down box to show specified list based on selections from another drop down box however I actually need to mimic this action for 3 additional drop down box fields.

Basically my 1st drop down box has about four items to select. Depending on which item they select a 2nd drop down list would display another list that is tailored to the 1st drop down's choice. Now I already have the script for that.  What I need to do is instead of having the 2nd list compiled I also need about 5 other identical drop down lists to display the same list from the 2nd list. So when I select an item from the 1st drop down list, I want the tailored list to display in drop down list 1, drop down list 2, drop down list 3, drop down list 4, drop down list 5.

Please help!!  

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Probably tick-tacking with Srini, but here is a sample using preOpen: https://acrobat.com/#d=E21666w6wxo51bTqEku4ow

Good luck,

Niall

View solution in original post

7 Replies

Avatar

Level 10

Hi,

I would use the preOpen event on all of the other dropdowns. This way each drop down looks back at the selected item for the first dropdown and then populates itself based on that selection.

This is the main purpose of the preOpen event.

If you have your second dropdown working the way you want it, I would duplicate/copy this for the remaining 4.

Hope that helps,

Niall

Avatar

Level 10

Set the binding for Dropdownlist 2, 3, 4 and 5 to Global..That can solve the issue..

Thanks

Srini

Avatar

Level 2

The action taken is based on the script on the 1st drop down list to additem to 2nd drop down list. I don't know enough about LC to see if I can re-do the script on the 1st drop down list to additem to the additional drop down lists.

Basically, this is the part of my script to add the info:

DropDownList2.addItem("Media- Ski");

Can I expand DropDownList2 to include the other drop down fields?  Such as:

DropDownList2, DropDownList3, DropDownList4, DropDownList5.additem ("Media-Ski");

I experimented with this earlier and I don't think it works. I can't think of any other way to have the script apply to the other drop down boxes.

Help!

Avatar

Level 10

Please refer to the sample below.. I have placed 5 dropdowns and 4 of them have the same name. So when you change the value in the first dropdown it will loop thru the index of the other dropdowns and add items to them.

https://acrobat.com/#d=xMjOZSVyV*fKwID*2aJXzw

Correction:

          The above answer I mentioned to change it to Global binding.. That will work if you want to display the same selected value in all the dropdowns. But not to fill the dropdowns..

Thanks

Srini

Avatar

Correct answer by
Level 10

Hi,

Probably tick-tacking with Srini, but here is a sample using preOpen: https://acrobat.com/#d=E21666w6wxo51bTqEku4ow

Good luck,

Niall

Avatar

Level 2

Thanks Srini, that looks like what I'm trying to do except for one other issue.  I need to be able to freely choose items from each of the addtl drop down boxes rather than all boxes reflecting the same selected item for all.  They all need to have the same lists of items but I want the user to be able to independently select different choices for each of the boxes.

I hope this makes sense. Thanks!

Avatar

Level 2

Thanks Niall!! With your sample, I was able to make it work and it was much simpler than what I had before. Many thanks!!