[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1005
  • Last Modified:

Prevent double submit when users doubleclick an asp:button

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
webressurs
Asked:
webressurs
  • 2
1 Solution
 
basicinstinctCommented:
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
 
X-treemCommented:
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
 
webressursAuthor Commented:
0
 
webressursAuthor Commented:
Disables button when clicking it.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now