Jump to content

onClick Disable submit button Help


coupe-r

Recommended Posts

Hi All,

 

I would like to have my submit button disabled on click, so the button cannot be pressed over and over again. 

 

I try using:

 

onclick="this.disabled=true;return true;"

 

But then nothing posts...  Any ideas?

 

If it isn't too much trouble, how would I change the value of the button to "processing..." AND disabled onClick?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/254020-onclick-disable-submit-button-help/
Share on other sites

what I would do is check for the form submission and then proceed to disable the submit button. I also recommend jquery for this. A simple solution could be,

 

document.getElementById("form_id").onSubmit = function() {
      document.getElementById("submit_id").disabled;
};

 

of course there is room to expand upon this, but this will do the trick.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.