wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Meier <s...@meiers.net>
Subject Re: Feedback messages not showing on first request
Date Thu, 28 Nov 2019 19:44:36 GMT
Hi,

hard to tell from your code snippet.

Could you remove the irrelevant part (the request attribute) and show us 
the visibility control instead?

A quickstart would help too.

Have fun
Sven


On 26.11.19 16:53, Entropy wrote:
> 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
>

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


Mime
View raw message