Conversation
supportScenario: You fill out the form, get the tick with recaptcha, but miss a required field and get the prompt. You complete the required field and try to resubmit. Form now fails with “Captcha mismatch, Please try again.” – except there’s no option to recheck the box since it’s still checked. Shouldn’t the recaptcha reset after a failed submission? Ninja Forms Version 2.9.45 Ninja Forms reCAPTCHA Version 1.2.5 https://wordpress.org/plugins/ninja-forms-recaptcha-field/
I have exactly the same problem. Anyone a solution? thanks!
This is my solution to the problem: (function($) { $(document).ready(function() { jQuery(".ninja-forms-form").on('submitResponse.resetCaptcha', function(e, formData, jqForm, options){ if (grecaptcha && grecaptcha.getResponse()) { grecaptcha.reset(); } }); }); })(jQuery); It resets the captcha state (if it was activated) after submitResponse event. This is a solution for ajax powered form.
(function($) { $(document).ready(function() { jQuery(".ninja-forms-form").on('submitResponse.resetCaptcha', function(e, formData, jqForm, options){ if (typeof grecaptcha !== 'undefined') { // add error manually if captcha isn't solved if (!grecaptcha.getResponse()) { jQuery("#ninja_forms_field_8_error").prop("innerHTML", 'Please confirm that you are human'); } // reset captcha if (grecaptcha.getResponse()) { grecaptcha.reset(); } } }); }); })(jQuery); A slightly improved version.
I have exactly the same problem. Anyone a solution? thanks!
This is my solution to the problem: (function($) { $(document).ready(function() { jQuery(".ninja-forms-form").on('submitResponse.resetCaptcha', function(e, formData, jqForm, options){ if (grecaptcha && grecaptcha.getResponse()) { grecaptcha.reset(); } }); }); })(jQuery); It resets the captcha state (if it was activated) after submitResponse event. This is a solution for ajax powered form.
(function($) { $(document).ready(function() { jQuery(".ninja-forms-form").on('submitResponse.resetCaptcha', function(e, formData, jqForm, options){ if (typeof grecaptcha !== 'undefined') { // add error manually if captcha isn't solved if (!grecaptcha.getResponse()) { jQuery("#ninja_forms_field_8_error").prop("innerHTML", 'Please confirm that you are human'); } // reset captcha if (grecaptcha.getResponse()) { grecaptcha.reset(); } } }); }); })(jQuery); A slightly improved version.