Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

Dynamic Drop Down lists populated with single value as default not showing until down arrow clicked.

Avatar

Level 3

I have over 1600 lines of code to set items to a drop down. In some cases the subsequent drop down only has a single value. I am trying to get the value to show without the user having to click the down arrow. I have tried various events to achieve this. I am using rawValue instead of setItems for those selections which only populate the subsequent drop down with a single option. The client would like the subsequent drop-down to have the singular value show and set the field to readOnly and focus on the third drop down. So far, I have the singular value working but it requires the user to click the down arrow, and, I cannot set the drop-down to readOnly if the field does not show the singular item. So, is there a way to script the down button on a drop-down from another field or the same field?

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can set the selectedIndex property to change the value of a dropdown list. It takes a 0-based integer to select the nth item from the dropdown list.

 

// Select the third item
DropdownList.selectedIndex = 2;

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

You can set the selectedIndex property to change the value of a dropdown list. It takes a 0-based integer to select the nth item from the dropdown list.

 

// Select the third item
DropdownList.selectedIndex = 2;