| Author |
Quick question on SelctOneMenu component
|
Luke Murphy
Ranch Hand
Joined: May 12, 2010
Posts: 299
|
|
Hi,
I am using a SelectOneMenu component, and I bind the selected value to a backing bean as such:
<h:selectOneMenu id="componentselection" value="#{components.choice}">
<f:selectItem itemValue="One" itemLabel="One"/>
<f:selectItem itemValue="Two" itemLabel="Two"/>
<f:selectItem itemValue="Three" itemLabel="Three"/>
</h:selectOneMenu>
I have a submit button adjacent to this which when pressed will call the getChoice() method and update the value of the choice.
However, I'd like to send the selection without needing a submit button.
How do I this? Use a valueChangeListener?
Is there any speedier way :-)
Thanks
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
|
You can use onchange="this.form.submit();"
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14475
|
|
|
It's friendly to allow auto-submit like this as long as no confusion results. However, it's also good practice to include a Submit button next to the menu in case the user switched off JavaScript.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: Quick question on SelctOneMenu component
|
|
|