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

{ 1 comment… read it below or add one }

DelliNo Gravatar May 25, 2010 at 12:37 am

Hi,

Thanks lot for post, and this is working perfectly in IE not in Mozila, the button is not disabled in Mozila where as its disabling in IE. could you please reply me, this is urjent.

thanks in advance

Leave a Comment

Previous post:

Next post: