g-recaptcha-response is ALWAYS EMPTY

13,927 views
Skip to first unread message

Edward Seaman

unread,
Nov 9, 2015, 1:41:11 PM11/9/15
to reCAPTCHA
I'm automatically rendering widget.

I have a site key registered. When I solve the captcha I get back a textarea with id=g-recaptcha-response,  but it's always empty...

What am I missing?

Andreas Lund

unread,
Nov 11, 2015, 4:33:07 PM11/11/15
to reCAPTCHA

I have the same problem. The form value "g-recaptcha-response" never gets set and I don't have a clue why.

Andreas Lund

unread,
Nov 12, 2015, 3:23:37 AM11/12/15
to reCAPTCHA

Found a workaround, see if this helps for you too:
  1. Add a tiny JavaScript callback function e.g. onHuman()
  2. Add a parameter "data-callback" to the ReCAPTCHA div tag
  3. Add a hidden form element used to hold the response string (use a different id/name, e.g. "captcha")
<SCRIPT type="text/javascript">
 
function onHuman(response) {
    document
.getElementById('captcha').value = response;
 
}
</SCRIPT>
<DIV class="g-recaptcha" data-callback="onHuman" data-sitekey="#### your site key goes here ####"></DIV>
<INPUT type="hidden" id="captcha" name="captcha" value="">

Now you can ignore the empty "g-recaptcha-response" and check for "captcha" instead.

Damien Adam

unread,
May 11, 2017, 6:41:54 AM5/11/17
to reCAPTCHA
Same issue today, g-recaptcha-response created but not populated

Andreas Lund workaround was my savior !
Reply all
Reply to author
Forward
0 new messages