Skip Navigation

[Résolu] Do not allow to submit form multiple time

This support ticket is created Il y a 5 années et 10 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 11 réponses, has 2 voix.

Last updated by Christian Cox Il y a 4 années et 9 mois.

Assisted by: Christian Cox.

Auteur
Publications
#906775

Hello, it shouldn't be possible to submit the form multiple times. I had a lot of users hitting the submit button up to 5 times due to slow loading times and then 5 posts were created.

I'd like to avoid that but how?

cheers,
Nick

#906961

Thanks for the report. This looks like a regression, there was code built-in to the older version of CRED to prevent this. It appears that the problem is not apparent if the form uses AJAX submission. I will escalate this to the team for further investigation. Stand by and I will update you as soon as I have more information to share. In the meantime, it appears that an AJAX form submission can help prevent this problem.

#906981

Thank you Christian.

#906983

will Ajax submission make the form submit faster or doesn't it really matter?

#907101

Even with an AJAX form submission, if you want to show a message or redirect to another page after form submission, the page will reload anyway. If you choose "keep showing this form" after submission then AJAX will usually be faster since the page doesn't have to reload.

#912645

Hello Christian.

Are there any updates on this?

Regards,
Nick

#912676

I have nothing new to report yet, I can see the ticket has been added to our internal bug tracker and will be prioritized and addressed with other Forms issues. If a patch or other workaround is made available, I'll update you here.

#913163

Thank you.

#915326

hey, do you have an update for me?

I've been getting a ton of duplicate posts lately (pretty much daily) and unfortunately, I can't use the form with ajax submission in my case.

#915422

I can show you how to make the button disabled after it's clicked, but it doesn't really help much because you need to be able to determine whether or not the form has passed front-end validation. Otherwise, you will disable the button and block subsequent form submissions when the User begins with invalid input. If the form is very simple, like it only accepts text inputs and doesn't use front-end validation (like an email or number field, for example), then it might be possible to write some JS that helps. Can you share a screenshot of the form, and tell me what types of fields are shown?

#916925

Thanks, Christian.

Actually, I am using the AJAX form submission feature now with this code

function onElementInserted(containerSelector, elementSelector, callback) {

    var onMutationsObserved = function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes.length) {
                var elements = $(mutation.addedNodes).find(elementSelector);
                for (var i = 0, len = elements.length; i < len; i++) {
                    callback(elements[i]);
                }
            }
        });
    };

    var target = $(containerSelector)[0];
    var config = { childList: true, subtree: true };
    var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
    var observer = new MutationObserver(onMutationsObserved);
    observer.observe(target, config);

}

onElementInserted('body', '#lbl_generic', function(element) {
    console.log('error');
    var TopPosition = jQuery('.page-campaign-form, .page-campaign-form-edit').offset().top;
    jQuery('html, body').animate({scrollTop:TopPosition}, 'slow');

However when the post redirects and there's a long loading time it just shows a blank white screen with a small text of ...redirecting...

Would be nice to customize it. I don't want to lose users there if the loading time is too long, which happens sometimes even though I use wpengine.

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/fr/forums/topic/customize-forms-redirection-message/

#1277863

Hi, Forms 2.4 has just been released and includes a fix for the original problem. It is no longer possible to create multiple posts by clicking submit multiple times in a non-AJAX form. Please update and let me know if the problem is not resolved. Thanks for your patience!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.