Forums

Troubles with noCaptcha with ajax

slon777 03 Feb, 2017
Hi everyone, especially Bob!
I have found another troubles and they deal with AJAX. Look, I have form with google nocaptcha validator. Now, image, I fill all fields in form and forgot to use repactcha and click submit button. Of couse it returns me the error with message about wrong validation. So, when I do it without ajax, it completely reload the whole page and show recaptcha again, but when I do it with ajax, it returns me everything but captcha doen't appear again -> it disappears.
Can anyone help me with this problem?
GreyHead 04 Feb, 2017
HI sion777,

Not sure about this, I'll try to take a look. I think it needs some way to validate that ReCaptcha has been checked - I have a feeling that we've looked at this before, I'll have to go hunting.

Bob
slon777 04 Feb, 2017
Hi Bob,
Thank you for suggestions. I have tried to find solution with custom validation of reCaptcha, but in firebug found error: "placeholder element must be empty". Then I have found this silution: you have to put this code in onLoad

<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>


Now, I understand that this is Google's problem🙂

But I have still another problem with WYSIWYG editor, which also disappears after reload form with ajax. Test area with text and html tags appears but without visual editor... Now, I'm looking for any solutions...

By the way, have a perfect hunting!!!
WaWeWo 21 Mar, 2017
Thanks sion777, your solution worked for me as well!

Only problem I have in this case, that 2 hidden fields lose their value. But that is the smallest of the problems :-)

Cheers, Peter
yaegerdesign 27 Jan, 2018
@slon777, I tried adding "Custom Code" to the "onLoad" event at the very top with the script you mentioned, but now I get the "placeholder element must be empty" error every time the page loads!
yaegerdesign 27 Jan, 2018
I fixed the issue by moving the script to the top of the "onFail" event inside the "Check Google noCaptcha" event which is inside the "onSubmit" event.
vivora66 13 Feb, 2018
Perfect!, thank you so much this totally solve the issue... there are other fourms with this some issue, and the problem always was google... thank you again
vivora66 12 Jun, 2018
when i use this solution I have the below error in the debuger console
​
reCAPTCHA couldn't find user-provided function: onloadCallback
This topic is locked and no more replies can be posted.