There is no attachment in both of your mails.
I don't see this line in your first message.

Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Jul 9, 2015 at 9:42 AM, gump lee <[email protected]> wrote:

> Thanks,
>
> Actually I did it. refer to my attached code, I register my
> AjaxcallListener. Did I register the AjaxCallListener correctly?
>
> On Thu, Jul 9, 2015 at 2:23 PM, Martin Grigorov <[email protected]>
> wrote:
>
> > Hi,
> >
> > You need to register the AjaxCallListener:
> > attributes.getAjaxCallListeners().add(myAjaxCallListener)
> >
> > Martin Grigorov
> > Freelancer. Available for hire!
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Thu, Jul 9, 2015 at 5:11 AM, gump lee <[email protected]> wrote:
> >
> > > Hello All,
> > >
> > > I am using Wicket 6.19. I added a
> > > AjaxFormComponentUpdatingBehavior("keypress")
> > > to a textfield so that when press any key will trigger my application
> to
> > > update something. I want this only happen when user press 'Enter' key.
> so
> > > that I override the method updateAjaxAttributes in the
> > > AjaxFormComponentUpdatingBehavior
> > >
> > > @Override
> > > protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
> > > super.updateAjaxAttributes(attributes);
> > > AjaxCallListener myAjaxCallListener = new AjaxCallListener() {
> > > @Override
> > > public CharSequence getPrecondition(Component component) {
> > > String script = "var keycode = Wicket.Event.keyCode(attrs.event);"
> > > + "if (keycode == 13) {"
> > > + "    return true;"
> > > + "} else {" + "    return false;}";
> > >
> > > return script;
> > > }
> > > };
> > > attributes.getAjaxCallListeners().add(myAjaxCallListener);
> > > attributes.setEventPropagation(EventPropagation.STOP);
> > > }
> > >
> > > However, after the ajax call, the form submit also triggered. Does
> anyone
> > > know the correct way to stop this form submit?
> > >
> > >
> > > Thanks and best regards,
> > > Gump
> > >
> >
>

Reply via email to