Matteo Pezzanera
Matteo Pezzanera

Reputation: 53

I have two wicket feedback panel in the same page and both respond to the same error message

I have two differend Wicket FeedbackPanel in the same page, one is for error messages and the other for success messages. The problem is when i call feedback1.error("bla bla bla") both the feedback panels were painted.

feedbackErrorOptionsPanel = new FeedbackErrorPanel("feedbackErrorOptionsPanel");
feedbackErrorOptionsPanel.setOutputMarkupId(true);
feedbackErrorOptionsPanel.setOutputMarkupPlaceholderTag(true);
feedbackErrorOptionsPanel.setEscapeModelStrings(false);
feedbackErrorOptionsPanel.setFilter(new ContainerFeedbackMessageFilter(this));
add(feedbackErrorOptionsPanel);

...

feedbackSuccessOptionsPanel = new FeedbackSuccessPanel("feedbackSuccessOptionsPanel");
feedbackSuccessOptionsPanel.setOutputMarkupId(true);
feedbackSuccessOptionsPanel.setOutputMarkupPlaceholderTag(true);
feedbackSuccessOptionsPanel.setEscapeModelStrings(false);
feedbackSuccessOptionsPanel.setFilter(new ContainerFeedbackMessageFilter(this));
add(feedbackSuccessOptionsPanel);

...

feedbackErrorOptionsPanel.errorWithLink("messaggio da visualizzare", "Per aggiungere clicca qui!", WebPage.class, null);

the method errorWithLink is used to add a link insisde the message error. This metod call the error() method inside my class that extend FeedbackPanel

Can anybody tell me how can I call feedback1.error to display with the first and feedback2.success to display with the second one?

Upvotes: 1

Views: 1272

Answers (2)

Andrea Del Bene
Andrea Del Bene

Reputation: 2511

you should use ErrorLevelFeedbackMessageFilter (or ExactLevelFeedbackMessageFilter) instead of ContainerFeedbackMessageFilter to obtain the desired behavior. for more details check the user guide.

Upvotes: 1

martin-g
martin-g

Reputation: 17533

FeedbackPanel has constructor that accepts IFeedbackMessageFilter - org.apache.wicket.markup.html.panel.FeedbackPanel#FeedbackPanel(java.lang.String, org.apache.wicket.feedback.IFeedbackMessageFilter).

You can pass org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter with the respective level to both of them.

Upvotes: 1

Related Questions