Hi, Check whether the browser makes an Ajax request to the server when you click the link.
Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Apr 17, 2015 at 11:20 PM, Christopher Merrill < [email protected]> wrote: > Thanks, Sven. I read that and I _think_ I understand it. I looked back at > the source and found: > > > Wicket.Ajax.ajax({"u":"./OrganizationAdministration?7-1.IBehaviorListener.0-form-create_customer_link","e":"click","c":"create__customer__link5","i":"create__customer__link5--ajax-indicator"});; > > which seems to be registering a listener. But that doesn't tell me why my > onClick() code is not called. > > This part of the article you linked: > "The good news is the client APIs are mostly the same and the application > developers will not need to change their applications." > seems to be indicating that I should not have to change my code - as the > IndicatingAjaxLink component (a wicket extension) or the AjaxLink should be > handling that. Am I wrong? > > This page seems to indicate overriding onClick() for an AjaxLink is still > the way to go: > https://wicket.apache.org/guide/guide/ajax.html > > I feel like I'm missing something... > > Chris > > > > > > On Thu, Apr 16, 2015 at 3:59 PM, Sven Meier <[email protected]> wrote: > > > Hi, > > > > #2 is with an IndicatingAjaxLink. > >> But the generated HTML has a bad href and no onClick(): > >> > > > > Wicket uses event registration now: > > > > http://wicketinaction.com/2012/07/wicket-6-javascript-improvements/ > > > > Have fun > > Sven > > > > > > > > On 16.04.2015 19:31, Christopher Merrill wrote: > > > >> Our app hasn't been under active development for a while, so we have > >> fallen > >> a bit behind. We're about to start a new project with our wicket app, > so I > >> thought our first step should be getting current. I read the migration > >> guide - it helped get me through a lot of issues. So I've been able to > get > >> past all the obvious stuff (compile errors) and have our app up and > >> running > >> under 6.19, with a few glaring problems. There is nothing in the console > >> or > >> logs when I exercise these pages/functions. > >> > >> #1 is with rendering a full page URL (for inclusion in an email). > >> > >> After constructing the parameters, our code does this: > >> Url url = RequestCycle.get().mapUrlFor(page_class, parameters); > >> return _req_cycle.getUrlRenderer().renderFullUrl(url); > >> > >> In 1.5, this generated a URL like this (which works) > >> > >> > >> > http://localhost/portal/pages/registration/[email protected]&m=-1663176292159862270 > >> but now we get: > >> > >> > >> > http://localhost/portal/pages/registration/pages/registration/[email protected]&m=-1663176292159862270 > >> > >> Note the extra "pages/registration/". Any ideas where I should look into > >> this? The pages are mounted with a friendlier URL - could this be > related? > >> > >> > >> #2 is with an IndicatingAjaxLink. > >> The HTML looks like this: > >> <a href="#" wicket:id="create_customer_link"><img > >> src="images/add_button.gif"><wicket:message > >> key="Create_customer">create...</wicket:message></a> > >> And we create it with: > >> _create_customer_link = new > >> IndicatingAjaxLink<License>("create_customer_link") > >> { > >> @Override > >> public void onClick(AjaxRequestTarget target) > >> { > >> followed by our onClick logic. > >> > >> But the generated HTML has a bad href and no onClick(): > >> <a href="javascript:;" wicket:id="create_customer_link" > >> id="create__customer__linkf"><img > >> src="../../images/add_button.gif"><wicket:message > >> key="Create_customer">Create customer</wicket:message></a><span > >> style="display:none;" class="wicket-ajax-indicator" > >> id="create__customer__linkf--ajax-indicator"><img > >> > >> > src="../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/indicator-ver-1429197921240.gif" > >> alt=""/></span> > >> Before the upgrade, it would render as: > >> <a href="#" id="id29" onclick="if (function(){return > >> Wicket.$('id29') != null;}.bind(this)()) { > >> Wicket.showIncrementally('id29--ajax-indicator');}var > >> > >> > wcall=wicketAjaxGet('OrganizationAdministration?15-1.IBehaviorListener.1-form-create_customer_link',function() > >> { > >> > >> > ;Wicket.hideIncrementally('id29--ajax-indicator');}.bind(this),function() > >> { > >> > ;Wicket.hideIncrementally('id29--ajax-indicator');}.bind(this), > >> function() {return Wicket.$('id29') != > null;}.bind(this));return > >> !wcall;"><img src="../../images/add_button.gif">Create customer</a><span > >> style="display:none;" class="wicket-ajax-indicator" > >> id="id29--ajax-indicator"><img > >> > >> > src="../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/indicator-ver-03CE3DCC84AF110E9DA8699A841E5200.gif" > >> alt=""/></span> > >> > >> I feel like I should know where to start investigating this, but it's > been > >> a few years since I've been active with Wicket and I'm flailing around a > >> bit at the moment. Any help would be greatly appreciated! > >> > >> TIA! > >> Chris > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > >
