Expand my Community achievements bar.

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.