reCAPTCHA v2
ExpressionEngine 1.x, ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From Denik
Failed recaptcha blanks all the form fields
Support Request
elsmore
|
Posted: 12 October 2017 06:26 AM |
|
|
|
Recaptcha is working fine, however a failed test reloads the page and blanks the form fields. Can I pevent this from happening and show a “you have failed captcha” message?
EE 2.10.01
Freeform 4.2.0
{exp:freeform:form form_name="pc_contact" form:class="contact-form" form:id="contact-form" inline_errors="yes" ajax="yes" require_captcha="yes" return="/thank-you/contact"}
form fields etc.
{if freeform:captcha}{freeform:captcha}{/if}
<button type="submit" class="btn btn-primary">Send</button> {/exp:freeform:form}
|
|
|
Denik
|
Posted: 12 October 2017 07:09 AM |
# 1
|
|
Developer
|
Hello,
you can just apply the code as shown here:
https://stackoverflow.com/questions/27902539/how-can-i-validate-google-recaptcha-v2-using-javascript-jquery
like this:
$("form").submit(function(){ var response = grecaptcha.getResponse();
if(response.length == 0) { alert('reCaptcha not verified'); return false; } else { //reCaptch verified } });
best regards
|
|
|