• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

SelectOneListbox question.

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my app I have a few selectOneListbox instances. Depending on the selection in the first, the second one gets populated

For example, say listbox1 looks like this:

1
2
3
4

If the user clicks on 2, then the values associated with item two get placed into listbox2.

Now all that is working just fine, but there is a problem. Say that the user selects 2 in listbox1 and that adds items to listbox2 that look like this:

a
b
c
d

Now say the user selects item b in listbox2. Still OK, but when the user then goes back to listbox1 and selects a different item, say item 3, then when the items associated with item 3 get populated into listbox2, it shows item b has already having been selected!

So, in short, whatever the user selects in listbox2 for any item will be selected automatically when the user seelcts a different option in listbox1.

This is not what I want.

I have tried doing listboxDefaultItems.clear() on listbox2, but it still autoselects the item every time!

So, how can you unselect a selectOneListbox in this case?

Thanks!
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you show me the code to your backing bean, I have a project setup I use for testing and I can throw your code in and see what happens. I just don't feel like recreating all your code right now.
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gregg Bolinger:
If you show me the code to your backing bean, I have a project setup I use for testing and I can throw your code in and see what happens. I just don't feel like recreating all your code right now.



It's pretty big (whole thing is over 2000 lines...lots of white space and comments of course).

Maybe I could give you some parts of interest, but I walked through it (JSC IDE) in the debugger and I can say for certain that my code isn't setting the value.

In short, I checked every place that a listbox.setValue(someIndex) is done and none of them were being called. It's like the listbox remembers the index and resets itself to it each time.

Is there not a way to "deselect" the listbox maybe? I tried doing a listbox.setValue("") but that just seemed to specify the first entry in the box instead of unselecting anything.
[ September 28, 2005: Message edited by: Darrin Smith ]
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic