2013/9/24 Martin Grigorov <mgrigo...@apache.org> > There is no "confirm" word inside this JS code... > It seems your component is not loaded yet. If it is loaded later with Ajax > then you have to find it in the Ajax response. Use Firebug or similar tool > to do this. > > > On Tue, Sep 24, 2013 at 8:39 PM, Markward Schubert < > markward.schub...@gmail.com> wrote: > > > Martin, > > > > > > Hi, > > > > > > Check the generated JavaScript for this JS event binding in the page > > > markup. > > > It should look like: Wicket.Ajax.ajax({....}) > > > Paste it here if you need help. > > > > > > On Tue, Sep 24, 2013 at 8:21 PM, Markward Schubert < > > > markward.schub...@gmail.com> wrote: > > > > > > > Hi! > > > > > > > > I am not very experienced with Wicket and have to maintain an older > > > project > > > > of ours. > > > > Now I wanted to migrate to Wicket 6 for a couple of reasons and had > to > > > > change the behavior of a "javascript-confirm before execute" > situation > > > with > > > > an AjaxLink. > > > > > > > > add(new AjaxLink<String>("clearContentLink") { > > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > > @Override > > > > protected void updateAjaxAttributes(AjaxRequestAttributes > > > > attributes) { > > > > super.updateAjaxAttributes(attributes); > > > > > > > > IAjaxCallListener listener = new AjaxCallListener() { > > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > > @Override > > > > public CharSequence getPrecondition(Component > > > > component) { > > > > return new JsonFunction("!confirm('Do you > > really > > > > > > > > > > Here you miss "return " in the function body. > > > > > > > > > > want to clear this logfile?')"); > > > > } > > > > }; > > > > > > > > attributes.getAjaxCallListeners().add(listener); > > > > } > > > > > > > > @Override > > > > public void onClick(AjaxRequestTarget requestTarget) { > > > > // clear here > > > > } > > > > }); > > > > > > > > This above Link is added to a Panel (P2), which is created as a > > reaction > > > to > > > > a click on another AjaxLink in another Panel (P1). P2 is wrapped in > an > > > > AjaxLazyLoadPanel. > > > > > > > > The behavior I now observe is, that the confirm dialog is shown, when > > the > > > > P2, the one containing the link i wanted to enrich, is shown. When I > > > click > > > > on the actual link, no confirm is shown. So speaking as a "noob > > > observer" I > > > > would say, my AjaxCallListener was bound to some "onShowLink" event > and > > > not > > > > the "onclick" of the Link. > > > > > > > > Can anyone help? > > > > > > > > Thanks and Regards, > > > > Markward > > > > > > > > > > > > > This is what I could extract from the site: > > > > <script type="text/javascript" >/*<![CDATA[*/Wicket.Event.add(window, > > "domready", function(event) { > > > > > Wicket.Ajax.ajax({"u":"./?0-1.IBehaviorListener.0-mainPanel-tabs-tabs~container-tabs-0-link","e":"click","c":"link1"});;Wicket.Ajax.ajax({"u":"./?0-1.IBehaviorListener.0-mainPanel-tabs-tabs~container-tabs-1-link","e":"click","c":"link2"});;Wicket.Ajax.ajax({"u":"./?0-1.IBehaviorListener.0-mainPanel-tabs-tabs~container-tabs-2-link","e":"click","c":"link3"});;Wicket.Ajax.ajax({"u":"./?0-1.IBehaviorListener.0-mainPanel-tabs-tabs~container-tabs-3-link","e":"click","c":"link4"});;Wicket.Ajax.ajax({"u":"./?0-1.IBehaviorListener.0-mainPanel-tabs-panel","c":"panel5"});;;});/*]]>*/</script> > > >
Ok, sorry for being so dumb :-) Here we go: <![CDATA[(function(){Wicket.Ajax.ajax({"u":"./.?1-1.IBehaviorListener.0-mainPanel-tabs-panel-content-logcontent-content-clearContentLink","e":"click","c":"clearContentLink57","pre":[!confirm('Do you really want to clear this logfile?')]^});})();]]> This is part of the second of two GET requests, being protocolled in Firebug's console when I click on a Link in Panel P1. I assume these two happen because of P2 being loaded as the content of a lazy loaded Panel?