You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Predrag Spasojevic <pr...@gmail.com> on 2010/05/29 11:45:26 UTC

Problem with AjaxSubmitButton when adding a form to the target

I have problem with following code:
AjaxFallbackButton button = new AjaxFallbackButton("button", commentForm) {

private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
 //do some business stuff
                                 // ......

commentForm.setDefaultModel(new CompoundPropertyModel<Comment>(new
Comment()));
*target.addComponent(commentForm);*
target.addComponent(commentsPanel);

}
};

User after submitting form via ajax stays on the same page and the form is
cleared so that user can fill and submit the form once again.
On first submit everythings works well. On the second submit the form is not
submitted via ajax but in a regular way. The problem is in
target.addComponent(commentForm). When I removed that line everything worked
well.

-- 
Regards,
Predrag Spasojevic