Calling _javascript_ function on wicket component's onclick has been edited by Martin Makundi (Jul 01, 2008).

(View changes)

Content:

Calling a _javascript_ function on a component's onclick:

...

new AjaxLink("link") {
  protected onClick(AjaxRequestTarget target) { ...}
  protected IAjaxCallDecorator getAjaxCallDecorator() {
    return new AjaxCallDecorator() {
      public CharSequence decorateScript(CharSequence script) {
        return "alert('This is my _javascript_ call'); " + script;
      }
    }
  }
}

...

An alternative approach:

link.add(new AttributeAppender("onclick", new Model("alert('This is my JS script');"), ";"));

Also see HOWTO do Javscript call after each Wicket AJAX update
Also see Generic Busy Indicator (for both Ajax and non-Ajax submits)

Reply via email to