Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form submit button remains disabled when using Back button in Firefox

I'm using some jquery to disable a form submit button after it's been clicked to prevent accidental repeated clicking. This works fine in all browsers except Firefox. In Firefox if the user uses the browser Back button to go back to a page after the submit button disabling has occurred, the submit button is still disabled. Is there any solution to this problem?

like image 674
BowserKingKoopa Avatar asked Jan 29 '10 21:01

BowserKingKoopa


2 Answers

Probably, you should add autocomplete="off" parameter to your form

<form autocomplete="off">
  <input type="submit" />
</form>
like image 82
Kirzilla Avatar answered Oct 13 '22 00:10

Kirzilla


$(document).ready(function() {
    $('input[type=submit]', this).attr('disabled', false);

    $('#myform').submit(function(){
        $('input[type=submit]', this).attr('disabled', true);
    });    

});

Using jQuery, this will make the button not disabled upon using the back-button on the browser. Tested on FF 3.5.

like image 37
Erik Avatar answered Oct 13 '22 01:10

Erik