Hi Lorno,
I faced the same problem, and I only get this working by
overriding onDetach() and reading getFeedbackmessageModel() of my Feedbackpanels in combination with the Feedbackpanel.setMaxMessage(1).

FeedbackPanel f = new FeedbackPanel("feedback"){
        @Override
        protected void onDetach() {
//to let setMaxMessages(1) work correct, we have to mark all other messages rendered, //otherwise they will be shown in sequence one-by-one as long as the user reloads the page
                
                for(FeedbackMessage f : getFeedbackMessagesModel().getObject()){
                        f.markRendered();
                }
                
                super.onDetach();
        }
}
f.setmaxMessage(1);

I'm not sure, why I have to do it, and if its a bug or feature or misunderstanding by me... but this works for me.

best regards
Patrick



Am 12.02.2016 um 15:24 schrieb Lorne Malvo:

I have a form with a large number of textfields I want to validate for
numerical input. However, if multiple fields fail validation, I want to
display only a single error message.

I'm using an AjaxSubmitLink to submit my form.

To avoid displaying multiple error messages when multiple textfields fail
validation, I figure I could just delete all FeedbackMessages generated
during form validation, and then register my own FeedbackMessage.
However, it seems a thing of impossibility to delete (or mark as rendered)
existing FeedbackMessages.

I'm trying to do this in an AjaxSubmitLink's onError() method like this:

FeedbackCollector collector = new FeedbackCollector(form);
for (FeedbackMessage fm : collector.collect()) {
        fm.markRendered();
}

But that doesn't do the trick. The feeback messages are found, but marking
them as rendered doesn't prevent them from being displayed.
I also tried collector.collect().clear() but that also doesn't work.

I also tried to do the same thing by overriding the form's onValidate()
method and deleting the messages right after validation, but that also
doesn't work.

How to get rid off these damn things?  :)

Thanks!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-get-rid-off-Feedback-Messages-tp4673577.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to