Solved

Prevent double submit when users doubleclick an asp:button

Posted on 2012-04-13
4
990 Views
Last Modified: 2012-05-02
When users doubleclick an asp:button the form is added twice in the database. What is the best and easiest way to prevent this?

Can it be done in the Stored Procedure (SQL)? Or by using Jquery? Or code behind by disabling the button on submit?

Hope some of you experts can give me a good advice :)
0
Comment
Question by:webressurs
  • 2
4 Comments
 
LVL 23

Expert Comment

by:basicinstinct
ID: 37841512
you could disable the submit button (when it's clicked) using javascript (jquery) - that doesn't PREVENT double submit but makes it less likely to happen.
to prevent it from happening you would need to try to detect the double submit issue - like, for instance, not honoring two subsecond requests in a row with the same exact data in the same exact session.
0
 
LVL 8

Expert Comment

by:X-treem
ID: 37841775
in your submit code, verify if the same record exists (eg only the previous record or a record submitted in the last x seconds), you can also add an identifyer and check if that exists.
if there is no result, you can create a new record
0
 
LVL 1

Accepted Solution

by:
webressurs earned 0 total points
ID: 37901160
0
 
LVL 1

Author Closing Comment

by:webressurs
ID: 37918361
Disables button when clicking it.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question