Skip Navigation

[Resolved] CRED ajax forms, prevent duplicate post

This support ticket is created 6 years, 6 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Beda 6 years, 4 months ago.

Assisted by: Beda.

Author
Posts
#574169

I have a problem with CRED forms that creates multiple posts on submit.
The form is ajax enabled and the form shows a message after submit.
I noticed that multiple clicks are allowed and registers as multiple form submissions.
The users are not very patient. They click repeatedly on the submit button until the form success message is shown.
I get two or three duplicate posts on almost every form submission.

Can I do something to prevent this.
Is it possible to add a "one" click event instead of an "on" click?
Or some function ...

#574409

When you have a Message (Success Message) in a CRED Form, the AJAX is partially interrupted because we need to reload the page to present the message at the moment.

I also observed that when I click on the Submit at first and try to click more than once, I need to do that real fast 😀
I can click eventually three times before the button already disappears - if I do it fast.

But it is correct; I can create Duplicates with this method.

The button should probably be disabled on click, and not remain active until the redirect happens.

This is even worse if you have no redirection in place but keep showing this form with AJAX, or, even without AJAX.
If you click on that submit button as life would depend on it, you will create a lot of duplicates.

And I can very well imagine this happening when for example an internet is a bit slow; users will start to click again and again, because "nothing happens" - and lots of duplicates will be the result.

I will escalate this for a review.

Thank you for the report.

I have no workaround right now, but I think it will be formed with some custom code for the moment, as:
https://stackoverflow.com/questions/17106885/disable-submit-button-only-after-submit
hidden link

I will keep you updated.

#574531

Regarding your links.

A bit worried about disabling the button on click. What happens if there is an error in the form?

I think the problem is that many of my users have slow internet connection (as you mention).
The users of this site are elderly people with very poor computer experience, I think that they "double click" instead of "single click" and does this repeatedly.

I never got more than 3 duplicates, but 2 is not rare.

#581392

This issue has been solved by the DEV. The solution will be shipped with CRED 1.9.3, the next release of CRED.

I will update you here once that is released.

#588000

This is resolved in the current stable CRED release.

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