Disabling an AJAX submit button

by kinabalu on July 19, 2009

A long running process that you’d like to show some indicator of progress or similar, usually means an indicator of some kind. Here we use an IndicatingAjaxButton to show some progress near the clicked submit button, and we use an IAjaxCallDecorator to disable the submit button so we don’t get multiple clicks

form.add(new IndicatingAjaxButton("submit", form) {
 
    @Override
    protected IAjaxCallDecorator getAjaxCallDecorator() {
        return new AjaxPostprocessingCallDecorator(super.getAjaxCallDecorator()) {
            private static final long serialVersionUID = 1L;
 
            @Override
            public CharSequence postDecorateScript(CharSequence script) {
                return script + "this.disabled = true;";
            }
        };
    }
}

Similar Posts:

Share this:
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Slashdot
  • Technorati

Leave a Comment

Previous post:

Next post: