• Post Reply Bookmark Topic Watch Topic
  • New Topic

valueChanged question/problem  RSS feed

Matt Lehning
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I posted this under another valueChanged thread but haven't seen a reply yet so I thought maybe it was buried too deeply.

I have a page with 3 combo-boxes (selectOneMenu) on it. They are interrelated. By that I mean initially, box #1 is initialized and enabled while boxes #2 & 3 are disabled. There also is a submit button labeled "Go" which has a doGoBtnAction method.

Selecting a value in box #1 submits the page's form (via JavaScript onchange) which then triggers the handleBox1ValueChange method to be executed. In that method, I want to issue a JDBC query using the value in box #1 to get list items for box #2.

IF the list for box #2 comes back with only one item, I want to go ahead and issue a JDBC query for box #3 using the values from boxes #1 and 2. Otherwise, box #3 remains disabled.

Boxes #2 and 3 each have a JavaScript onchange to submit the form and each have a handleBoxXValueChange method.

Assume box #2 only had one list item so now box #3 is populated and enabled. The goofy thing I'm seeing is that if I now make a selection in box #3, when the form gets submitted, JSF executes the handleBox2ValueChange method instead of the handleBox3ValueChange.

The same would occur if I clicked the "Go" button to submit the form. Initially, the handleBox2ValueChange method would execute, THEN the doGoBtnAction method.

What makes it even weirder (to me, anyway) is the values that are stored in the valueChangeEvent newValue and oldValue properties. They are NOT necessarily the previous and current values in the combo-box!! Sometimes they're a value or two behind (i.e. the 'oldValue' is two selections ago, the 'newValue' is the previous selection, not what's currently in the combo-box).

So.......that's a lot of detail and background to get to my question, which is this:

Does anyone know where JSF stores the 'oldValue' or what it uses as the oldValue to compare with the 'newValue'? And where is that newValue obtained from since like I said, it's not always what I have currently selected.

All the combo-boxes are mapped to a property in a bean with a scope of session. The backing bean used on my page retrieves those values in the beginning.

I'm really confused and I hope this explanation makes some sense.

Thanks for your help,
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!