Take a look at: http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/markup/html/form/Button.html#setDefaultFormProcessing(boolean)
On Fri, Sep 4, 2009 at 7:01 PM, Neil Curzon <[email protected]> wrote: > Hi all, > > I'm having a weird problem that causes an input to refuse to update with an > AjaxLink click method when there's been a validation error. One field in > the > form has a property model pointing to an Integer value. It's set to > required, and there are other links that set the Integer value. > > What I see is that when I first click a link that populates the Integer > under the required field, everything works fine. But when I click submit > first, the populate links stop working. The handlers are still invoked, but > the HTML that comes back in the Ajax Debug shows an input with value="" > (even though the getModelObject() for that TextField returns the proper > value in debugging statements). This results in the input always being > showed empty. If I do things in the proper order, I see the correct value > populate in the text field as expected. It's not just a display issue, > either. The form refuses to submit successfully at all if there was a > validation error first (and you don't manually enter anything into the > field). > > Below is a simple application that reproduces the issue I'm seeing. I'm > using wicket 1.3.7 but I've tried 1.4.1 with the same result. Any help > would > be greatly appreciated. > > Thanks > Neil > > > > public class HomePage extends WebPage { > > public HomePage() { > add(new TestForm("testForm")); > } > > class TestForm extends Form { > > private Integer value; > private FeedbackPanel feedbackPanel; > private TextField testInput; > > public TestForm(String id) { > super(id); > > add(feedbackPanel = new FeedbackPanel("feedbackPanel")); > feedbackPanel.setOutputMarkupId(true); > > add(testInput = new TextField("testInput", new > PropertyModel(this, "value"))); > testInput.setRequired(true); > testInput.setOutputMarkupId(true); > > add(new AjaxButton("submitButton"){ > @Override > protected void onError(AjaxRequestTarget target, Form form) > { > target.addComponent(feedbackPanel); > } > > protected void onSubmit(AjaxRequestTarget target, Form form) > { > info("It worked!"); > target.addComponent(feedbackPanel); > } > }); > > add(new AjaxLink("chooseOneLink"){ > public void onClick(AjaxRequestTarget target) { > value = 1; > target.addComponent(testInput); > target.addComponent(feedbackPanel); > } > }); > } > } > } > > <html> > <body> > <form wicket:id="testForm"> > <div wicket:id="feedbackPanel"/> > <input wicket:id="testInput"/> > <a wicket:id="chooseOneLink">Choose 1</a> > <button wicket:id="submitButton">Submit</button> > </form> > </body> > </html> >
