On Mon, May 18, 2009 at 2:07 PM, Martin Makundi
<[email protected]> wrote:
> Does not look right... but who am I to say. Why do you call
> field.setModel(getModel()) at all?
>
I have to set the model of the nested component somewhere. I can't
set it in the constructor, because the model is not available then.
The documentation for FormComponentPanel suggests doing it in
onBeforeRender.
> I would leave it out alltogether (= not change model). If you have
> other reasons to change the model, then you can override the
> FormComponent.internalOnModelChanged:
>
> /**
> * @see
> org.apache.wicket.markup.html.form.FormComponent#internalOnModelChanged()
> */
> �...@override
> protected void internalOnModelChanged() {
> onValid(); // Do not clear input
> }
The docs say not to override this method, so I'd rather not do that.
I found that if I initialized the nested component in onBeforeRender
with the model (making sure I do it only once), then I got the
behaviour I wanted. I don't understand why that works though.
Ian.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]