Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

choose from SelectOneMenu, get the result in a SelectOneMenu

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, im doing web programming, and i was wondering how can i make
it like when i choose from a SelectOneMenu, then i get the result
from what i choosed in a new SelectOneMenu?

For example:

choose from this:

cycle -showing cycle first
car
bus
train

if i choose bus

i want the result like this:

cycle
car
bus -show bus first
train

i hope for any help, thanks:)
 
Ranch Hand
Posts: 99
MyEclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Run a javascript function on onchange or onselect event that compares the values and set the selected property of the second field to the option that matches the original.
 
Legend Mvb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Akaine Harga wrote:Run a javascript function on onchange or onselect event that compares the values and set the selected property of the second field to the option that matches the original.


Im a noob:P
how do i set the value in SelectOneMenu?
i have it like this:

<h:selectOneMenu style="height:25;" value="#{enTreningsOkt.treningsokten.kategoriValgt}" >
<f:selectItems value="#{user.tempTreningsOkt.kategori.kategorier}"/>
</h:selectOneMenu>

thanks:)
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a similar problem: I need to know, in my back manage bean, what is the selected item. My selectOneMenu is created dynamically from a database query. By now I don’t have the answer yet.

I think the idea of Akaine is interesting…


Run a javascript function on onchange or onselect event that compares the values and set the selected property of the second field to the option that matches the original.



Nevertheless the javascript event should be onchange and also use additional hinding html element binding with the back manage bean. Don’t use onselect because that event is for textarea or textfield when the text is selected.

I’m looking for a better solution…please help.
 
Legend Mvb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it work when i select a categori, i got the selected categori in the other menu. But when im trying to
get a categori from a database, the selectOnemenu is showing the first categori and not the categori from the
database.

please help, thanks:)
 
Enrique Villamizar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<h:selectOneMenu style="height:25;" value="#{enTreningsOkt.treningsokten.kategoriValgt}" >
<f:selectItems value="#{user.tempTreningsOkt.kategori.kategorier}"/>
</h:selectOneMenu>



I solved that problem this way:



The List has elements of type POJO representing the table in the database filled with the query(if not null).

Hope this could help.
 
Legend Mvb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Enrique Villamizar wrote:

<h:selectOneMenu style="height:25;" value="#{enTreningsOkt.treningsokten.kategoriValgt}" >
<f:selectItems value="#{user.tempTreningsOkt.kategori.kategorier}"/>
</h:selectOneMenu>



I solved that problem this way:



The List has elements of type POJO representing the table in the database filled with the query(if not null).

Hope this could help.


thank you very much, i will try it
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
The trailboss has a kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic