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. **