DelphiFAQ Home Search:

Avoid that a HTML FORM is submitted twice


comments9 comments. Current rating: 3 stars (3 votes). Leave comments and/ or rate it.


What is the best way to make sure a user does not submit a form twice?


The easiest way: Disable the submit button in the onclick() event. See the code for that in the box below.

You can also put some code in the form's onsubmit() event, as the second code snippet shows.

  disable the submit button after the first click: 
<input type="submit" onClick="this.disabled=true">

  Note: the following goes all in one line. 
  This method sets a 'flag' (this.submitted) to 
  avoid multiple submissions of your form.

<form action=".." \
 onsubmit="if (this.submitted) return false; \
else { \
this.submitted = true; disableSubmits(this); \
return true;}"

Content-type: text/html


2005-12-12, 22:04:54
anonymous from France  
If the user clicks 'back' he opens again the form but it's dead
2006-04-01, 09:39:43
anonymous from India  
2008-04-26, 05:53:55
anonymous from Uganda  
2008-11-04, 08:28:50
anonymous from India  
what if the user submits the form using enter button. i am afraid if it still works.
2009-03-19, 00:56:16
anonymous from United States  
2012-06-05, 21:31:18
anonymous from China  
<strong> http://www.coachout..strong> <a href=' http://www.coachout..g>Coach Outlet Online</strong></a><br />
<strong> http://www.coachfac..strong> <a href=' http://www.coachfac..g>Coach Factory</strong></a><br />
<strong> http://www.myloveco..strong> <a href=' http://www.myloveco..g>Coach Outlet Online</strong></a><br />
<strong> http://www.buyincoa..strong> <a href=' http://www.buyincoa..g>Coach Outlet</strong></a><br />
<strong> http://www.cheapcoa..strong> <a href=' http://www.cheapcoa..g>Cheap Coach Handbags</strong></a><br />
<strong> http://www.coachfac..strong> <a href=' http://www.coachfac..g>Coach Factory Outlet</strong></a><br />
<strong> http://www.buycoach..strong> <a href=' http://www.buycoach..g>Coach Outlet Online</strong></a><br />
<strong></strong> <a href=' http://www.coachout..g>Coach Factory Outlet</strong></a><br />
<strong></strong> <a href=' http://www.coachout..g>Coach Outlet Online</strong></a><br />
<strong></strong> <a href=' http://www.coachfac..g>Coach Factory</strong></a><br />
<strong></strong> <a href=' http://www.gotocoac..g>Coach Outlet Online</strong></a><br />
2012-11-12, 02:07:41
anonymous from United Kingdom  
2013-02-04, 05:40:49
rakdxf <a href=' '>payday loans</a> 3847 <a href=' '>payday loan</a> 9726 <a href=' '>payday loans</a> DBhav
2015-01-30, 00:15:08
I wish to express my aoipecpatirn to this writer just for rescuing me from this scenario. Right after searching throughout the world-wide-web and getting suggestions which were not helpful, I figured my life was done. Being alive without the approaches to the problems you have solved all through your guideline is a serious case, as well as those which could have adversely affected my career if I had not come across the blog. Your good training and kindness in taking care of almost everything was valuable. I don't know what I would've done if I had not come upon such a stuff like this. I can at this moment relish my future. Thanks a lot very much for your professional and result oriented help. I won't think twice to suggest your blog to any person who should get guidelines about this situation.



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: