On Wed, Sep 9, 2009 at 12:35 PM, Kito Mann <kito.mann(a)virtua.com> wrote:
On Wed, Sep 9, 2009 at 12:33 AM, Lincoln Baxter, III <
lincolnbaxter(a)gmail.com> wrote:
> One more issue I'd like to bring up: it appears that when using
> <f:valueChangeListener action="..." /> the value of the object
provided has
> not yet been updated in the model, hence, the value is the old value, not
> the new value.
>
> When using <f:actionListener> on the button submitting the values, the new
> value is populated into the model instead... which is the behavior I would
> expect.
>
> Pardon the probably obvious question...
>
> Is there an contract with valueChangeListeners that states they fire
> before model updates? I see in the spec that it fires: "when a new local
> value has been created, and has passed all validations," but nothing about
> if the model has been updated or not.
>
They're fired after the Process Validations phase (or Apply Request Values
if immediate=true), which always occurs before the Update Model phase. The
idea is that the input must be in a valid state before the model is updated.
And that the value change listener is notified of the intent to change the
model value, hence giving it a chance to block the update (or at least that
becomes a possible course of action).
-Dan
--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597
http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan