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.

Populate Multiple Dropdown Lists From Selection

Avatar

Level 2

I'm building a form in Livecycle Designer ES 8.2.1 that will have about a dozen sections (subforms) to collect data. Each section will have two drop-down lists, one to select a name and one to select the date.


Is there a way to set-up the form so that when the name and date are selected, the remaining drop-down lists will display the same name and date.

For example, If all of the drop-down lists have the same three names (Tom, Dick & Harry) and Tom is picked from one of the drop-down lists, I want all the other drop-down lists to display the name Tom. Same with the dates.

More than likely, the same name and date will appear in all of the drop-down lists. However, I want the user to be able to change any of the names and dates if needed, for instance go to a drop-down list that displays Tom and change it to Dick or Harry without affecting/changing the others.

I'm not very good at this so if anyone has any suggestions, please explain in very simple terms.

Thanks!

Kurt

2 Replies

Avatar

Level 10

For the scenario you had explained, you need to write script to achieve that.

Once you choose some thing in the first dropdown, you should populate the value in the rest of the dropdowns only if  they do not have any selected value. If any of the rest of the dropdowns has a value then do not change it.

//Write the code in the DropDown1 exit event to check whether the DropDown2 has a value selected..

if(DropDown2.selectedIndex != -1){

     DropDown2.rawValue = DropDown1.rawValue;

}

if(DropDown3.selectedIndex != -1){

     DropDown3.rawValue = DropDown1.rawValue;

}

etc...

Hope this can give an idea..

Thanks

Srini

Avatar

Level 2

Srini.....thanks for your reply.

I'm having some problems getting the script to do what I need. The script works if there is an initial selection in each drop-down list.

Here is what I've tried and how it works. Please bear with me, I'm not experienced with Javascript so I'll try to explain it the best I can.

Following script applied as exit event on dropdown1.

if(DropDown2.selectedIndex != -1){

     DropDown2.rawValue = DropDown1.rawValue;

}

if(DropDown3.selectedIndex != -1){

     DropDown3.rawValue = DropDown1.rawValue;

}

How it works  (starting with all 3 dropdown lists blank with no default value applied).

Select "Tom" in dropdown1

Select "Dick" in dropdown2

Select "Harry" in dropdown3

Go back to dropdown1 and change "Tom" to "Dick". The script changes dropdown2 and dropdown3 to reflect the current selection in dropdown1, in this case "Dick".

What I need is the following (starting with all 3 dropdown lists blank).

Select "Tom" in dropdown1 and script applies "Tom" to dropdown2 and dropdown3.

Go to dropdown2 and change “Tom” to “Dick”. Dropdown1 and dropdown 3 are unchanged and still show “Tom”.

I'd like to attach a sample so you can see what I've done so far, but I can't find the "Browse" button to attach a file.

Hope this makes sense.

Kurt