Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent double submit with a4j:commandButton

We have a form which has a submit button (input type="submit") and a bunch of a4j:commandButtons which are ajax buttons that translate into input type="button".

I'm able to use this jquery code to prevent double submitting of the submit button:

         $('#createPostingForm').submit(function(){
          $(':submit').click(function() {  
                 return false;  
          });
        }); 

But how can I also disable the a4j:commandButtons from being submitted more than once?

Thanks.

like image 253
RichFaces4Life Avatar asked Nov 23 '10 20:11

RichFaces4Life


1 Answers

Ended up adding these attributes to the a4j:commandButton:

onclick="this.disabled=true" oncomplete="this.disabled=false"
like image 192
RichFaces4Life Avatar answered Sep 28 '22 00:09

RichFaces4Life