0

I'm getting 2-3 submissions from the same user when they submit.. all with the same information. I can't figure out if a refresh of the page or something is doing this? Any ideas how i can stop this? i was going to use prevent duplicates on the email address, but won't this block that same user from submitting a form in the future?

5
  • Can you duplicate this behavior? Is there any javascript working with the form? Can we see the opening tag for your form?
    – Jim Wyse
    Jan 13 '16 at 1:08
  • I can't duplicate it, but we get at least 2-3 a day with 2 or more duplicates. I'm not using any javascript with the form. Here is my opening tag: {exp:freeform:form form_name="consult" return="thank-you" required="first_name|last_name|email" inline_errors="yes" class="nomargin" } Jan 13 '16 at 23:17
  • Intermittent problems are always the most fun to chase down, especially when you can't duplicate the behavior. Not sure what to tell you at this point. Do they all have the same ip and timestamp? If the timestamps are different, they are perhaps confused and resubmitting the form.
    – Jim Wyse
    Jan 14 '16 at 13:09
  • Same IP, different time stamps within seconds apart. I'm guessing that it's user related. Some are spam as well. Speaking of those, I thought there was a place that you could block the IP or email address? Jan 15 '16 at 15:52
  • You can do that in the Blacklist/Whitelist module. Not sure how that works for form submissions.
    – Jim Wyse
    Jan 15 '16 at 17:47
1

Had the same issue on multiple high traffic sites, it was due to the users slow internet connection so they would click the submit button multiple times while the form was processing. Eventually found a useful piece of code to stop this

<script>
 var $j = jQuery.noConflict();
 jQuery.fn.preventDoubleSubmission = function () {
            $j(this).on('submit', function (e) {
                var $form = $j(this);

                if ($form.data('submitted') === true) {
                    // Previously submitted - don't submit again
                    alert('Form already submitted. Please wait.');
                    e.preventDefault();
                } else {
                    // Mark it so that the next submit can be ignored
                    // ADDED requirement that form be valid
                    if($form.valid()) {
                        $form.data('submitted', true);
                    }
                }
            });

            // Keep chainability
            return this;
        };

$j('form').preventDoubleSubmission();
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.