Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas Lee 38 posts 79 karma points
    Jul 07, 2015 @ 05:37
    Thomas Lee
    0

    Multiple entries on Form Submit

    Hi I am using Umbraco Form,

    The issue i am facing is that the loading takes alittle too long, some users got impatient and clicked on the submit button again.

    Is there a way to disable the submit button only when the form passes validation?

    Sincerely, Thomas

  • Steve Morgan 1345 posts 4452 karma points c-trib
    Jul 07, 2015 @ 15:05
    Steve Morgan
    0

    Hi Thomas,

    It's not perfect (as it doesn't stop non-js resubmits) but how about a bit of javascript..:

    change contourformContactForm to match the id of your form (use the browser inspector tools if you're not sure). Add a class to your css for .disabled to grey out the button.

    $(document).ready(function () {
    
        var formSubmitted = false;
    
        $('#contour_form_ContactForm').submit(function (event) {
            $('#contour_form_ContactForm input').addClass("disabled");
            if (formSubmitted) {
                event.preventDefault ? event.preventDefault() : event.returnValue = false
                console.log("no double submits");
            }
            formSubmitted = true; // stop double submits
        });
    });
    
  • Steve Morgan 1345 posts 4452 karma points c-trib
    Jul 07, 2015 @ 15:06
    Steve Morgan
    0

    That should read change #contour_form_ContactForm

  • Steve 140 posts 321 karma points
    Mar 10, 2016 @ 17:26
    Steve
    0

    Hi Thomas,
    I needed to resolve the same problem with multiple Contour form submissions and achieved good results with the solution provide by Steve Morgan.
    Ultimately, I found adjusting the properties of the submit button directly worked well.
    $('input[type="submit"]').prop('disabled', true); $('input[type="submit"]').prop('value', 'Processing');

Please Sign in or register to post replies

Write your reply to:

Draft