| Author |
dynamic drop down menus with javascript
|
Jamie Williams
Ranch Hand
Joined: Mar 31, 2006
Posts: 70
|
|
|
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.
|
 |
Ravisekhar Kopparthi
Greenhorn
Joined: Jul 12, 2006
Posts: 5
|
|
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
Joined: Mar 31, 2006
Posts: 70
|
|
|
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?
|
 |
 |
|
|
subject: dynamic drop down menus with javascript
|
|
|