My problem is: Have a page jsf with 2 SelectOneMenu and 1 commandButton like this <h:selectOneMenu binding="#{nuevoExpediente.cbObra}" valueChangeListener="# {bean.cbObra_OnChange}" onchange="submit()" > <f:selectItem itemLabel="Nuevo" itemValue="-1" itemDescription="Introducir nuevo poseedor" /> <f:selectItems binding="#{bean.listobras}" /> </h:selectOneMenu>
Cool, now, when the pages FIRST time that i select one item on selectonemenu or click button, page fires ALL events. I think this it because when initialize SelectOneMenu with value="#....", an one event onChange wait on a queue and when any object of form make submit() all event on a queue are throws. this is: 1� time when page load - click on a button - cbObra_OnChange fire ( on queue for give values? ) - cbCliente_OnChange fire ( on queue for give values? ) - cmbInsertar_OnClick fire ( yes, im clicked )
how i can do this? i want that when click on the button first time, only event of button fires.
try to create a project with this config and try because the selectonemenu allready have a items on JSF tag, and when load items, modify initials and fires
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
I already answered this over there at sun.com. The valueChangeListener will be invoked if the new value differs from the old value.
tazkirah laskdjf
Greenhorn
Joined: Sep 21, 2008
Posts: 3
posted
0
ok men, i read all your posts but, try on a new project, because not work...
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
It doesn't matter if you use a new or old project.
All what matters is that the valueChangeListener will be invoked if the new value differs from the old value. If you think logically, then you should realize that the solution is to make sure that the h:selectOneMenu value is the same as the default value of the f:selectItems. You can prepare that in the constructor of the backing bean or maybe during the filling of the list behind f:selectItems or so.