Hi,
Martin Grigorov writes: > > On Tue, May 31, 2022 at 6:50 AM Joachim Schrod <jsch...@acm.org> wrote: > > > > So I need to have the > > following functionality for this button: > > -- Before the submit, a target attribute "_blank" get's added to the > > form. > > -- The form is submittet, by this button. (I.e., its onSubmit() must > > be called.) > > -- Afterwards, the target attribute is deleted from the form. > > > > I'm looking for best practice to achieve that functionality with the > > available Wicket API. I.e., I want to prepend and append Javascript to > > the Wicket-supplied submit functionality of a button or ajax submit > > action. I have looked at Javadoc and source code of the following > > classes (and their superclasses) and didn't found any hook/method > > where I can achieve my desired result: > > -- AjaxRequestAttributes: No methods to prepend/append JS code. > > Actually this is the one you need ^^ > atrts.getAjaxCallListeners().add(new > AjaxCallListener().onBefore("...").onComplete("...")); > > see also onBeforeSend() and onAfter() Thanks a lot for this tip, it worked like a charm. I learned something new about Wicket; that's always a good thing. :-) When I did read "Listener" in the classe name, I associated it with some callback or event hook on the server side -- seems, that I need to pay more attention to the AJAX mechanisms, how they work. Cheers, Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jsch...@acm.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org