What is the best way to make sure an ASP.NET MVC action is not called twice (i.e. if the user clicks on a button twice in quick succession)? On most of our screens, it's not a big deal if it happens ... but on a few it causes havoc (like paying people multiple times instead of just once).
You could disable the submit button using javascript. For example with jQuery:
$(function() {
$('form').submit(function() {
$(':submit, :image', this).attr('disabled', 'disabled');
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With