Solved

Prevent double submit when users doubleclick an asp:button

Posted on 2012-04-13
4
993 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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 to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

710 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