reCaptcha is not validated
-
I successfully linked the reCaptcha to my contact form, but it is not validated on submit, so the user can submit without cheking the reCaptcha. I added the following code to script.js to make it work:
var reCaptchaMessage = ‘<div id=”recaptcha-message” class=”wpcf7-response-output wpcf7-validation-errors”><span>Please check the reCaptcha </span> <div>’;
var recaptcha = $form.find(‘#g-recaptcha-response’);
if(recaptcha) {
if(recaptcha.val().length == 0){
$form.append(reCaptchaMessage);
$form.addClass(‘invalid’);
$form.find(‘img.ajax-loader’).css({ visibility: ‘hidden’ });
return;
}else{
$form.removeClass(‘invalid’);
$form.find(“#recaptcha-message”).remove();}
}
anybody having the same issue?
- The topic ‘reCaptcha is not validated’ is closed to new replies.