veerap000 on "[Plugin: Contact Form 7] Disable submit button while loading"

ساخت وبلاگ

veerap000
Member
Posted 1 month ago #

Users can click the submit button while form is sending the message -> impatient users clicks the button multiple times -> the message is send multiple times -> multiple messages are messing up the analytics (Google goals, etc.).

Ready-to-use code for fixing can be found here: https://wordpress.org/support/topic/disable-button-on-form-submit

https://wordpress.org/plugins/contact-form-7/

arenddeboer
Member
Posted 3 weeks ago #

We are experiencing the same issue, multiple form submissions from impatient users. It would be great if the proposed solution can be integrated.

arenddeboer
Member
Posted 3 weeks ago #

I have a temporary solution which does not require hacking the plugin files. Add this javascript to your page. If you don't know how, use a plugin like "Simple Custom CSS and JS" and add as front-end javascript in footer.

jQuery(document).ready(function () { (function() { var ev = new jQuery.Event('style'), orig = jQuery.fn.css; jQuery.fn.css = function() { jQuery(this).trigger(ev); retu orig.apply(this, arguments); } })(); setTimeout(function () { jQuery('img.ajax-loader').bind('style', function (e) { var style = jQuery(this).attr('style'); //console.log("style: " + style); if(style) { if(style.indexOf("hidden") > 1) { // enable button //console.log("Disable button"); jQuery('input.wpcf7-submit').attr('disabled','disabled'); } else { //console.log("Enable button"); jQuery('input.wpcf7-submit').prop('disabled', false); } } }); }, 2000)
});

veerap000
Member
Posted 2 minutes ago #

Works like a charm, thanks!

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 321 تاريخ : دوشنبه 11 مرداد 1395 ساعت: 12:54