Our Blog

Let us find tech solutions together

Jul 20

Using FeedbackPanel with AJAX

By kinabalu | Comments

 

If you’d like to have your FeedbackPanel update with errors in the event of a problem with your form, just adding the FeedbackPanel won’t do you any good. Just as with any other AJAX-updating component in Wicket, you’ll need to add it to the AjaxRequestTarget, only difference is, you’ll have to do this while overriding onError like so:

1
2
3
4
5
6
7
8
9
final FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackPanel");
feedbackPanel.setOutputMarkupId(true);
form.add(feedbackPanel);
form.add(new AjaxButton("submit") {
    @Override
    protected void onError(final AjaxRequestTarget target, final Form form) {
        target.addComponent(feedbackPanel);
    }
});