You're right: The "later in #updateModel()" was the piece I wasn't 
considering. Tks.




From:   Sven Meier <s...@meiers.net>
To:     users@wicket.apache.org
Date:   02/13/2013 08:48 AM
Subject:        Re: FormComponentPanel.convertInput()



Hi,

#convertInput() should not modify the current model object, because form 
submission might still fail with a conversion error on another field.

Pushing the new input in the FormComponent's model is done later in 
#updateModel().

Hope this helps
Sven

On 02/13/2013 03:33 PM, Richard W. Adams wrote:
> I'm writing my first FormComponentPanel, and have a couple of books
> showing how to do this. Most of it seems straightforward, except one
> point: In the books' examples, FormComopnentPanel.convertInput() creates 
a
> new model object and populates it from a series of calls to
> getConvertedInput() on the panel fields. The examples then call
> setConvertedInput() to store the newly populated model object.
>
> The part I don't understand is this: Why create a NEW model object? Why
> not just call getModelObject() to get the ORIGINAL model, and populate 
IT
> with the new values? That would avoid the caller having to call
> getConvertedInput() on the panel component: The ORIGINAL model would be
> "magically" updated with the user-entered values when the form is
> submitted. That requires less work on the caller's part, and (IMHO) 
seems
> more consistent with the way other  property model paradigms work  in
> Wicket. (This, of  course, assumes the original model is mutable, which
> mine is.)
>
> Anyone have any thoughts on the pros & cons of these two approaches?
>
>
> **
>
> This email and any attachments may contain information that is 
confidential and/or privileged for the sole use of the intended recipient. 
 Any use, review, disclosure, copying, distribution or reliance by others, 
and any forwarding of this email or its contents, without the express 
permission of the sender is strictly prohibited by law.  If you are not 
the intended recipient, please contact the sender immediately, delete the 
e-mail and destroy all copies.
> **
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**

Reply via email to