This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Calling JavaScript function on wicket component's onclick
Skip to end of metadata
Go to start of metadata

Calling a JavaScript function on a component's onclick:

...

new AjaxLink("link") {
  protected onClick(AjaxRequestTarget target) { ...}

  @Override
  protected IAjaxCallDecorator getAjaxCallDecorator() {
    return new AjaxCallDecorator() {
      @Override
      public CharSequence decorateScript(Component c, CharSequence script) {
        return super.decorateScript(c, "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 Javascript call after each Wicket AJAX update
Also see Generic Busy Indicator (for both Ajax and non-Ajax submits)

  • No labels