Re: How to handle ListenerInvocationNotAllowedException on invisible field

2018-11-19 Thread Martin Grigorov
Hi,

If a component is invisible then it won't render itself. It might render
just its HTML element if you use
refineFields.setOutputMarkupPlaceholderTag(true), but none of its children
would be rendered, and their Ajax listeners won't bind at all.
So I think the reason is something else.

Often this kind of problem occurs when you override Component#isVisible().
In the first request it returns 'true' and the components and its children
are renderer. But later when the (ajax) request is executed it evaluates to
'false' and thus the exception.


On Mon, Nov 19, 2018 at 9:52 AM Vishal Popat 
wrote:

> Hi,
>
> I am using Wicket 7...
>
> Recently I have been getting lots of the following exception
> WARN RequestCycleExtra:347 - Handling the following exception:
> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
> Behavior rejected interface invocation. Component: [TextField [Component id
> = name]] Behavior: bidding.web.pages.search.RefineSearchFields$1@1471c2d
> Listener: [RequestListenerInterface name=IBehaviorListener, method=public
> abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
> at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:237)
> at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
> at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
> ...
>
> I have the following panel being called from SearchResults web page:
> RefineSearchFields refineFields = new RefineSearchFields("refineSearch",
> getPageParameters());
> refineFields.setVisible(doSearch());
> add(refineFields);
>
> Within the RefineSearchFields Panel, I have:
> final TextField nameField = new TextField("name", new
> PropertyModel(this, "name"));
> OnChangeAjaxBehavior nameFieldBehavior = new OnChangeAjaxBehavior() {
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> //do stuff
> }
> };
> nameField.add(nameFieldBehavior);
> form.add(nameField);
>
> I have found out why I get this exception... this is due to doSearch()
> returning false so the RefineSearchFields panel is not visible.
> However the behaviour is still added to the field that is invisible.
> What I would like, is to not execute/setup RefineSearchFields if its not
> visible.
> What is the Wicket way to do this?
>
> Many thanks
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


How to handle ListenerInvocationNotAllowedException on invisible field

2018-11-18 Thread Vishal Popat
Hi,

I am using Wicket 7...

Recently I have been getting lots of the following exception
WARN RequestCycleExtra:347 - Handling the following exception: 
org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException: 
Behavior rejected interface invocation. Component: [TextField [Component id = 
name]] Behavior: bidding.web.pages.search.RefineSearchFields$1@1471c2d 
Listener: [RequestListenerInterface name=IBehaviorListener, method=public 
abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:237)
at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
...

I have the following panel being called from SearchResults web page:
RefineSearchFields refineFields = new RefineSearchFields("refineSearch", 
getPageParameters());
refineFields.setVisible(doSearch());
add(refineFields);

Within the RefineSearchFields Panel, I have:
final TextField nameField = new TextField("name", new 
PropertyModel(this, "name"));
OnChangeAjaxBehavior nameFieldBehavior = new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
//do stuff
}
};
nameField.add(nameFieldBehavior);
form.add(nameField);

I have found out why I get this exception... this is due to doSearch() 
returning false so the RefineSearchFields panel is not visible.
However the behaviour is still added to the field that is invisible.
What I would like, is to not execute/setup RefineSearchFields if its not 
visible.
What is the Wicket way to do this?

Many thanks
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org