To prevent users from accidentally submitting your form multiple times you can add a bit of javascript to track if the form has been submitted and prevent further submits. If you are using the jQuery Validate plugin you can do this via submitHandler.

$('form.your-form').validate({
    rules: {
        name: 'required',
        email: {
            required: true,
            email: true
        }
    },
    submitHandler: function (form) {
        // Prevent double submission
        if (!this.beenSubmitted) {
            this.beenSubmitted = true;
            form.submit();
        }
    }
});
5 3 votes
Article Rating
in JavaScript, jQuery
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Joel Lindsey
Joel Lindsey
4 years ago

Thanks, this was exactly what I needed to fix my issue!

plamenm
plamenm
2 years ago

First, hello everybody! Now the question is, is it possible to fire a dimming div inside the submitHandler? What I’m trying to do is to dim the whole page onSubmit, but seems that can’t wrap it up. I appreciate any help. Here is the code: CSS: <style> #hide{ position:fixed; padding:0; margin:0; top:0; left:0; width:100%; height:100%; z-index:600; background-color:black; display:none; text-align:left; opacity: 0.5; } </style> HTML: <form id="send" name="send" enctype="multipart/form-data" action="" method="post"  > <input name="submit" class="alert" type="submit" value="SUBMIT"/> </form Script: <script language="javascript"> $("#hide").css("height", $(document).height()); /  $(window).bind("resize", function(){ $("#hide").css("height", $(window).height()); }); $(function() {            $("#send").validate({ rules: {         datepicker:… Read more »