How do I programmatically (in a JSP) set as 'selected' an item in a dropdown? | Community
Skip to main content
viren_pushpanay
Level 2
October 16, 2015
Solved

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

  • October 16, 2015
  • 1 reply
  • 678 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

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. 

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

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.