Disabling an AJAX Submit Button
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;";
}
};
}
}