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
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.
will Ajax submission make the form submit faster or doesn't it really matter?
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.
Hello Christian.
Are there any updates on this?
Regards,
Nick
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.
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.
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?
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.
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!