you need to override getAjaxCallDecorator() on the AjaxLink and return a new

AjaxCallDecorator that either prepends, appends (or both) your custom
javascript to the javascript created by the link.

cheers,
  Gerolf

On Jan 10, 2008 11:05 AM, mbelarbi <[EMAIL PROTECTED]> wrote:

>
> Hi, I want to call a javascript function ( myFunction() ) on a component's
> onclick event.
>
> I tried this:
>
> a wicket:id="myLink" onClick="myFunction();"
>
> but then i realized that my wicket's onClick() method is overwriting the
> above html one.
>
> ------
>        AjaxLink agentLink = new AjaxLink("myLink") {
>
>                public void onClick(AjaxRequestTarget target) {
>                        /* Some Code */
>                }
>        };
> -----
>
> So then i tried this:
>
> ------
>        AjaxLink agentLink = new AjaxLink("myLink") {
>
>                public void onClick(AjaxRequestTarget target) {
>                        target.appendJavascript("alert('hi from
> wicket');");
>                        /* Some Code */
>                }
>        };
> -----
>
>
> But i don't see the alert when i click the link, can someone help me out?
> --
> View this message in context:
> http://www.nabble.com/calling-javascript-function-on-wicket-component%27s-onclick-tp14730927p14730927.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to