You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by HHB <hu...@yahoo.ca> on 2009/04/28 15:21:27 UTC

How to erase model values?

Hey,
Usually, I set the model for a form like this:

final Form form = new Form("form", 
        new CompoundPropertyModel(new Contact()));

But when the panel or the modalwindow that contains 
the form is rendered again, the model's values are still saved and displayed.
So upon successful operation, I do the following to erase values:

form.setModel(new CompoundPropertyModel(new Contact()));

Is there a better way? like overriding a specific method?
Thanks for help and time.



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


Re: How to erase model values?

Posted by nino martinez wael <ni...@gmail.com>.
Hi

Sure, just do this in your onsubmit of the form,
compoundPropertyModel.setModlObject(new Contact());

OR one of the million other ways, it's just java :)

2009/4/28 HHB <hu...@yahoo.ca>:
> Hey,
> Usually, I set the model for a form like this:
>
> final Form form = new Form("form",
>        new CompoundPropertyModel(new Contact()));
>
> But when the panel or the modalwindow that contains
> the form is rendered again, the model's values are still saved and displayed.
> So upon successful operation, I do the following to erase values:
>
> form.setModel(new CompoundPropertyModel(new Contact()));
>
> Is there a better way? like overriding a specific method?
> Thanks for help and time.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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