How to disable submit button once it has been clicked?

maas picture maas · Jul 29, 2010 · Viewed 220k times · Source

I have a submit button at the end of the form.

I have added the following condition to the submit button:

onClick="this.disabled=true;
this.value='Sending…';
this.form.submit();"

But when it moves to the next page, the parameters did not pass and null values are passed.

Answer

Andreas Köberle picture Andreas Köberle · Jul 29, 2010

You should first submit your form and then change the value of your submit:

onClick="this.form.submit(); this.disabled=true; this.value='Sending…'; "