wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Entropy <blmulholl...@gmail.com>
Subject Feedback messages not showing on first request
Date Tue, 26 Nov 2019 15:53:21 GMT
We have a page where we are being required to have multiple feedback panels,
and to show messages in various ones depending on the error.  Our solution
was to use message filters and to put the messages against certain
containers to say 'any message in container X goes to feedback panel X'.  

You can see the code below for example.  The request thing is just to set
the class of the feedbackpanel to a different value.  But we also control
the visibility of the panel by checking 'anyMessage()'.  So if there's no
errors, no feedback shows.  

This all works...except on the first request.  For some reason when I click
the button, I can see the error (it's added during the onSubmit(), not
during the normal validation step if that makes a difference) added to the
assetLookupOptionsWMC, but then when anyMessage() runs, it doesn't find the
error.  Click the button a second time, and it works perfectly.

Any idea why?

		assetLookupOptionsFP.setFilter(new IFeedbackMessageFilter(){
			private static final long serialVersionUID = 1L;

			@Override
			public boolean accept(FeedbackMessage msg) {
				Component reporter = msg.getReporter();
				HttpServletRequest request = ((HttpServletRequest)
getRequest().getContainerRequest());
				
				if (reporter.getId().equals("assetLookupOptionsWMC")){
					if(msg.isError())
						request.setAttribute("assetLookupOptionsFeedbackPanelHasError",
"TRUE");
					return true;
				} else if
(reporter.getParent().getId().equals("assetLookupOptionsWMC")){
					if(msg.isError())
						request.setAttribute("assetLookupOptionsFeedbackPanelHasError",
"TRUE");
					return true;
				} else {
					return false;
				}
			}
			
		});

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message