Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Drop-down List

Avatar

Former Community Member

I've started using Adobe LiveCycle Designer for the last few weeks, and so far I'm really amazed by its features.

Since I'm new to it, I have a question related to Drop-down List

I'm creating a form, in this form I have Drop-down Lists...

1) Unit Name

     1.A)

     1.B)

     1.C)

2) Department Name

     2.A)

     2.B)

     2.B)

I would like when the user chooses on of the items in the Drop-down List 1, a specific items from the Drop-down List 2 will be shown, I mean that the items which will be shown in the second Drop-down list are dependent on the choice of the item from the first Drop-down list.

I don't know if this is possible or not, but I will appreciate any help.

Regards,

7 Replies

Avatar

Level 9

Hello Ahmed,

Yes, This is quite possible. First create 2 DropDown lists. In first DropDownlist add items that you needed. And in the change event of first dropdown list you should add the following code.

var newVal = this.boundItem(xfa.event.newText);  // Stores the dropdown value when the user selects something from the drop down list.
switch (newVal)                                    // Depending upon the selections made in the dropdown populates the state field based on that
{
    case "A":
        DropDownList2.clearItems();        
        DropDownList2.addItem('A');
        break;
    case "B":
        DropDownList2.clearItems();        
        DropDownList2.addItem('B');
        break;   
    case "C":
        DropDownList2.clearItems();        
        DropDownList2.addItem('B');
        break;   
    default:
    break;
}  

Thanks.

Bibhu.

Avatar

Former Community Member

Thanks Bibhu for the quick reply, but actually since I'm new to Adobe LiveCycle Designer I couldn't find the change event of the first Drop-down List

"And in the change event of first dropdown list you should add the following code."

Thnks

Avatar

Level 9

Hello Ahmed,

Click on the Dropdownlist1 first.Then click on the dropdown Show : Just above the script editor.Now click on the change. You can see the event changing to "change" event.

Dropdown.JPG

Thanks.

Bibhu.

Avatar

Former Community Member

Thanks Bibhu,

I had to show the "Script Editor" first since it's not shown to me, I'll check your method and reply to you.

Thanks

Regards,

Avatar

Level 9

Hello Ahmed,

If you can not see the Script editor. Then click on Window and select script editor. You can drag the script editor from below to adjust the space you need to type the scripts.

Thanks.

Bibhu.

Avatar

Former Community Member

Hello Bibhu,

I do really appreciate your help, it did work well with me, really cool thing man.

Thanks, and have a nice day

Regards,

Avatar

Level 9

Hello Ahmed,

Thank God !!! It worked.. Good Luck.

Bibhu.