Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

How to prevent double submission of registrations?

by

Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Troubleshooting › How to prevent double submission of registrations?

Tagged: double click, Multiple submissions

  • This topic has 4 replies, 2 voices, and was last updated 11 years, 10 months ago by admin.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 6, 2013 at 5:07 pm #9438
    mattrubinstein
    Member

    Hi there

    I’d like to prevent users from double-submitting registration forms, either by clicking the “Register” button twice, or by pressing Return/Enter on the final field and THEN clicking the “Register” button. It takes a moment for anything to happen after the first submission, and during this time it’s apparently possible to click the button again. Then two registration forms seem to be submitted, and the second one fails because the username is now already taken; and instead of logging in the user and redirecting to the welcome page (which I’ve enabled), we are left on the registration page with the errors.

    I’ve looked on the internet for Javascript solutions and have tried to fiddle around with the _onSubmitEvent function in jquery.validationEngine.js, but I can’t seem to both disable the “Register” button AND still get the form to submit on a single click.

    Is there a simple fix?

    August 7, 2013 at 7:26 am #56970
    mattrubinstein
    Member

    Just to follow up on this, I seem to have solved the problem for now by inserting the following code at the beginning of the _onSubmitEvent function:

    Code:
    var now = new Date().getTime();

    if ((this.beenSubmitted) && (now – this.beenSubmitted < 3000))
    {
    return false;
    }
    else
    {
    this.beenSubmitted = now;
    }

    So this disables any submission within 3 seconds of the last submission. Is this likely to have negative repercussions or is there a better way?

    Thanks

    Matt

    August 7, 2013 at 8:13 am #56971
    admin
    Keymaster

    Hi Matt, What you have done is pretty good and should work fine but I think we can do a little better. I like the idea of disabling the button after the first click so I am going to try to create a little eMember addon that disables the register button when it is clicked.

    August 9, 2013 at 9:57 am #56972
    mattrubinstein
    Member

    Thanks Key Master, that sounds good. Maybe some kind of “Please wait” like with the fancy login form would be useful too? And the other problem I was having with disabling the button was re-enabling it again if the validation fails. I’ll leave it with you!

    August 11, 2013 at 2:23 am #56973
    admin
    Keymaster

    The following little addon should do the job:

    http://www.tipsandtricks-hq.com/wordpress-membership/disable-button-after-form-submission-848

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ