• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dynamic drop down menus with javascript

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I need to have a list of categories to choose from in a dropdown menu that will populate a second menu with options, and have the value of the option selected in the second menu bound to a variable in a bean. Is this possible with JSF and if so, can someone give me some pointers? Thanks.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This is very much possible.
Lets say you have dropdown1 and dropdown2 in your page.

When you select dropdown1 get the value of it in backing bean
do your query to retrieve options for drop down to and set it in sessionScope.

Have the second drop down point to this variable in sessionScope
like this
<h:select id="options" value="#{sessionScope.options}" >


Now to bind this option back to JavaBean is very easy
again when a submit event is fired in the backing bean method
get the value of dropdown2 and set it on a JavaBean.

Hope this helps.

Thanks
Ravisekhar Kopparthi
 
Jamie Williams
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply, but I have actually already done that. What I need to know is how to do it with *Javascript* client-side instead of having to refresh the page each time the first listbox is changed. How can I do this?
 
reply
    Bookmark Topic Watch Topic
  • New Topic