Use a link and call form.clearinput()

-igor
On Jun 25, 2011 4:23 PM, "HarryBakker" <[email protected]> wrote:
> I'm a relative newby with Wicket and am struggling to get something to
work.
> Maybe somebody can help me?
>
> I have a form with some TextFields on it, that i'm using to keep track of
> some properties of a User. Some fields are required (they have the
> required() attribute set to true), some not. Now i want to have a 'reset'
> button on the form that let's me reset all fields to their original value.
I
> have the setDefaultFormProcessing() property of this resetbutton set to
> false, to prevent validation of the required fields that aren't currently
> filled by the user. In the onSubmit() of the button, i do the following
for
> every button (i'm only showing the code for this single button; the rest
are
> coded along the same lines):
>
> Form form = (Form) get("form);
> TextField name = (TextField) form.get("name);
> name.setDefaultModelObject(originalUser.getName());
> // ... rest of the fields ...
>
> After all fields are set to their original values the page is refreshed,
but
> the TextFields contents retain their current value. They are not reset to
> their original value, which i expected.
>
> What am i doing wrong?
>
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-can-i-reset-the-data-in-TextFields-tp3625099p3625099.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

Reply via email to