You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2012/12/02 01:24:59 UTC

How to continue to process event after trapping with AjaxEventBehavior

We're trapping key presses on a TextField like:
 
                        textField.add(new AjaxEventBehavior("keypress")
                        {
                                    private int count = 0;
 
                                    protected void
onEvent(AjaxRequestTarget target)
                                    {
                                                //To change body of
implemented methods use File | Settings | File Templates.
                                                System.out.println("An
keypress occurred " + count++);
                                    }
                        });
 
 
The onEvent method is getting called for every keystroke but the event
is being eaten up by the behavior and no characters appear in the
TextField.
 
Is there a method that onEvent can call to continue normal processing of
the event so that characters don't get eaten up?
 

Re: How to continue to process event after trapping with AjaxEventBehavior

Posted by Sven Meier <sv...@meiers.net>.
                     @Override
                     protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes)
                     {
                         super.updateAjaxAttributes(attributes);

                         attributes.setAllowDefault(true);
                     }

Sven

On 12/02/2012 01:24 AM, Chris Colman wrote:
> We're trapping key presses on a TextField like:
>   
>                          textField.add(new AjaxEventBehavior("keypress")
>                          {
>                                      private int count = 0;
>   
>                                      protected void
> onEvent(AjaxRequestTarget target)
>                                      {
>                                                  //To change body of
> implemented methods use File | Settings | File Templates.
>                                                  System.out.println("An
> keypress occurred " + count++);
>                                      }
>                          });
>   
>   
> The onEvent method is getting called for every keystroke but the event
> is being eaten up by the behavior and no characters appear in the
> TextField.
>   
> Is there a method that onEvent can call to continue normal processing of
> the event so that characters don't get eaten up?
>   
>


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


RE: How to continue to process event after trapping with AjaxEventBehavior [Solved]

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
This works fine if I trap the "keyup" event instead of the "keypress"
event.

>-----Original Message-----
>From: Chris Colman [mailto:chrisc@stepaheadsoftware.com]
>Sent: Sunday, 2 December 2012 11:25 AM
>To: users@wicket.apache.org
>Subject: How to continue to process event after trapping with
>AjaxEventBehavior
>
>We're trapping key presses on a TextField like:
>
>                        textField.add(new AjaxEventBehavior("keypress")
>                        {
>                                    private int count = 0;
>
>                                    protected void
>onEvent(AjaxRequestTarget target)
>                                    {
>                                                //To change body of
>implemented methods use File | Settings | File Templates.
>                                                System.out.println("An
>keypress occurred " + count++);
>                                    }
>                        });
>
>
>The onEvent method is getting called for every keystroke but the event
>is being eaten up by the behavior and no characters appear in the
>TextField.
>
>Is there a method that onEvent can call to continue normal processing
of
>the event so that characters don't get eaten up?
>

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