Hi All

THE JSF livecycle is like this
Faces Request -> Restore View -> Apply Request Values (call all the
setters) -> process events -> ...

There are two possible ways how to configure to submit a form: With a
button(and its action) or with the javascript onchange property on any
element. 
But the JSF Livecycles are DIFFERENT!!!

I got a setter and an event called updater. The updater uses the
variable "currentKpiGroup" which is set by the setter.


By button:
==========
<h:selectOneMenu
  id="selectedKpiGroup"
value="#{flowScope.KPIBrowserBean.currentKpiGroup}">
<f:selectItems value="#{flowScope.KPIBrowserBean.kpiGroups}" />
</h:selectOneMenu>

<h:commandButton action="#{flowScope.KPIBrowserBean.kpiGroupChanged}"
value="Change" styleClass="button" />

By onchange-property:
=====================
<h:selectOneMenu
  id="selectedKpiGroup"
value="#{flowScope.KPIBrowserBean.currentKpiGroup}"
  valueChangeListener="#{flowScope.KPIBrowserBean.kpiGroupChanged}"
  onchange="submit()">
<f:selectItems value="#{flowScope.KPIBrowserBean.kpiGroups}" />
</h:selectOneMenu>



So, everything works fine if I use the button to submit the form(console
oputput):

SETTER currentKpiGroup grp: 3
UPDATER(event) currentKpiGroup: 3

The setters are called before the events.




If I use the onchange property, the console output is this:

UPDATER(event) currentKpiGroup: 2
SETTER currentKpiGroup grp: 3

my application performs wrong because of the old
value(currentKpiGroup=2).
The event is process before the new value(currentKpiGroup=3) are set.



Does sombody know anything about this behavior? I need to submit the
form by onchange...

I'm looking forward to your answers!

Thanks,

Remo

Reply via email to