JavaScript Submit button hack


Thanks for visiting! If you're new here, you may want to subscribe to my Rss Feed. This blog posts regular Internet news, updates for apps, security, ideas, hacks, quick fixes and everything about hi-tech. Go ahead, Subscribe to our Feed or Register for Free!

submit-button-javascript-hack

On slow server or double clicks often we have double post and double comments on blogs forum, forms, uploading etc. Here is a fast JavaScript hack that can disable the Submit button after the first click. So after the users click submit, the button will be inactive for other incidental clicks. Just with adding this following line to your form inside the "input submit" tag:


onclick="myform.submit();this.disabled=true

here is the an example:

<form name=myform action="form.php" method=post">

<input type="submit" value="Submit" onclick="myform.submit();this.disabled=true">

</form>

And here is a visual when I clicked on Host:

javascript-hack-Host

Hope you enjoy this short guide.

Popularity: 5,010 reading
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Comments on “JavaScript Submit button hack”

  • 28 March, 2009, 7:17

    Nice to hear, now i am submitting forums but yet now i haven’t came across such a facility. If in future i got it i will respond you again. Thanks.

  • 20 March, 2010, 10:22

    Your code got out of the frame. Correct it!

  • 18 April, 2010, 16:54

    Thanks, I will!

Leave a Comment