• 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

Quick question on SelctOneMenu component

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use onchange="this.form.submit();"
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic