Solved

Prevent double submit when users doubleclick an asp:button

Posted on 2012-04-13
4
988 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
Comment Utility
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
Comment Utility
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
Comment Utility
0
 
LVL 1

Author Closing Comment

by:webressurs
Comment Utility
Disables button when clicking it.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now