How to handle click event on listBox
I have two listboxs. And I want to load The items into the second accordingly to the selected items in the first.And I want that the content of the second change each time the selected items of the first listbox are modified.
I don't know which event to handle for the first listBox indicating the items are selected in the first listbox. I want to execute the method loading items into the second listbox each time this event is fired.
Thanks in advance.
# 1
You can just use the 'onchange' attribute of the fist menu and put Javascript in it to submit the form on every menu change.<h:selectOneMenu onchange="this.form.submit();">
In the 2nd menu just check the current value of the 1st menu and then populate the list accordingly.
# 2
Thanks for your reply.
I used <webuijsf:listbox > component to display the list and .
And I want to allow user to select multiple items.
Then I want that the 2nd will be populated each time an item is selected.So the method doing it must be called in an action listener .
Please I don't really know how to use the <h:selectOneMenu> component.And I want that after the submit the 2nd list will be populated.
How can I do it please.
Thanks.
# 4
> You can just use the 'onchange' attribute of the fist
> menu and put Javascript in it to submit the form on
> every menu change.<h:selectOneMenu
> onchange="this.form.submit();">
In the 2nd menu
> just check the current value of the 1st menu and then
> populate the list accordingly.
When I submit the form the components like the second listBox will be reloaded ?
# 7
After the submit of the form , how can I please reload items in the second listbox.What I mean is which method to call.For example if I want th set a new value in a TextArea component a call its get method.
Which method is called to loaded item sin listbox to put in the code populating the listBox.
Thanks in advance.