This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Quick question on SelctOneMenu component  RSS feed

 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use onchange="this.form.submit();"
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!