Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable submit button once it has been clicked?

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.

like image 446
maas Avatar asked Jul 29 '10 20:07

maas


People also ask

How do I make a button disabled?

The disabled attribute is a boolean attribute. When present, it specifies that the button should be disabled. A disabled button is unusable and un-clickable. The disabled attribute can be set to keep a user from clicking on the button until some other condition has been met (like selecting a checkbox, etc.).


1 Answers

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

onClick="this.form.submit(); this.disabled=true; this.value='Sending…'; " 
like image 122
Andreas Köberle Avatar answered Sep 29 '22 05:09

Andreas Köberle