Newsletter signup form
This article will cover the Newsletter signup form, positioned at the bottom of the Front-end, inside templates/example.com/generic/newsletter_form.tpl.html template.
Form submission process
The process is handled using an AJAX request. By doing so, the Google ReCaptcha widget will remain locked for user re-evaluation if not reset after the submission process is completes. To reset the Google ReCaptcha widget, you need to have this included at the bottom of your trunk/templates/example.com/_js/generic.js JavaScript file which is included by default:
$(function() {
$.frontend.events.on('submit_email_signup_form.after', function (event, source_element) {
grecaptcha.reset(Google_ReCaptcha_Widget.<YOUR-var__id-VALUE>);
$('#<YOUR-var__id-VALUE>').val('');
});
});
where <YOUR-var__id-VALUE> is the value of var__id used when you include Google ReCaptcha widget into your template:
{form helper='widget' field='google_recaptcha' var__id='google_recaptcha_signup'}
Updated over 2 years ago