Imagine wizard workflow. Browser reset will reset to the value the page has been loaded with. Server-side reset will reset to whatever the application defines as default value.
On Mon, Sep 30, 2013 at 4:40 PM, Paul Bors <p...@bors.ws> wrote: > I'll like to hear more about Richard's use-case as to me using Ajax to > perform a form reset that could be done by the browser is a bit of an > overkill. Unless some sort of a user workflow through the app happens in > stages for which I would recommend using a Wizard. > > ~ Thank you, > Paul Bors > > -----Original Message----- > From: Martin Grigorov [mailto:mgrigo...@apache.org] > Sent: Monday, September 30, 2013 9:57 AM > To: users@wicket.apache.org > Subject: Re: Form Reset Problems > > Hi, > > I'm going to write a blog article about Form component's input vs. model. > I've been asked few times about this last two weeks by colleagues of mine. > It would be good to have it in the official guide though ( > https://issues.apache.org/jira/browse/WICKET-5321). > > To reset a form you should: > 1) use a button with default processing == false, to prevent form > validation (or just AjaxLink) > 2) call form.clearInput() > 3) and to set the "default" model for each form component. Each > application should know what "default" means for its form components. > > > On Mon, Sep 30, 2013 at 3:46 PM, Richard W. Adams <rwada...@up.com> wrote: > > > We're having trouble making our form reset button work. It's defined > > thusly: > > > > AjaxButton button = new AjaxButton("reset-button"); ... > > <input type="button" value="Reset" wicket:id="reset-button" /> > > _____________________________________________ > > > > Here's our reset code, executed when the button is clicked. The main > > form seems to re-render OK, but a FormComponentPanel that is part of > > the form does not. I see a lot of discussion on Wicket form resets on > > the Web, but most is several years old. Is there an "officially" > > endorsed pattern or example for doing Ajax form resets? > > _____________________________________________ > > > > public void onReset(final AjaxRequestTarget target) { > > > > final Component.IVisitor<FormComponent<?>> visitor = new > > Component.IVisitor<FormComponent<?>>() { > > > > @Override public Object component(final > > FormComponent<?> > > formComponent) { > > > > if (formComponent.getDefaultModel() != null) { > > // Must have a model for the component > > final Object currentValue = > > formComponent.getDefaultModelObject(); // Save model value > > formComponent.clearInput(); > // > > Clear out > > formComponent.setDefaultModelObject(currentValue); // Add the value back > > } > > if (target != null) { > > target.addComponent(formComponent); > > } > > return Component.IVisitor.CONTINUE_TRAVERSAL; > > } > > }; > > visitChildren(FormComponent.class, visitor); > > > > } > > > > > > ** > > > > 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 > >