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

SOLVED

How do I programmatically (in a JSP) set as 'selected' an item in a dropdown?

Avatar

Level 3

Hi,

How do I programmatically (in a JSP) set as 'selected' an item in a dropdown? Following is my code. 

<cq:include path="./country" resourceType="foundation/components/form/dropdown" />

I have a list of countries in the dropdown and want a country to be selected based on a value passed to the JSP.

Thank you.

Cheers,

Viren.

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can extend the component and add a method to set the dropdown based on value that you pass to it. All components are just JavaScript code. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

You can extend the component and add a method to set the dropdown based on value that you pass to it. All components are just JavaScript code.