0

The code is below.

The way I had set it up was that the form's Submit button is disabled by default. And if the user submits the correct CAPTCHA, the Submit button gets enabled (via jQuery/Javascript).

It used to work fine. And then one morning in end-May 2015 or early-June 2015, it stopped working.

Suggestions?

<html>
<head>

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

</head>
<body>


<form action="create_rb.php" method="post">
Text Field: <input type="text" size="40" name="name"><br>


<div id='html_element'></div>
<br/>
<input type="submit" class="button-primary" value="Submit" id="submitButton" style="height:50px; width:200px" disabled>
</form>



<script type="text/javascript">
  var correctCaptcha = function(response) {  //http://stackoverflow.com/questions/27902539/how-can-i-validate-google-recaptcha-v2-using-javascript-jquery
    var response = grecaptcha.getResponse();


    if(response.length != 0) {  //reCaptcha verified
        $('#submitButton').removeAttr('disabled');
    } 
  };


  var onloadCallback = function() {
    grecaptcha.render('html_element', {
      'sitekey' : 'my-site-key',
      'callback' : correctCaptcha
    });
  };


</script>


</body>
</html>
thanks_in_advance
  • 2,603
  • 6
  • 28
  • 44
  • Are you getting any Javascript errors in the console? Add some alerts to make sure you are reaching the code you are expecting. – Seano666 Aug 06 '15 at 17:45
  • Have you upgraded to v2? I'm pretty sure v1 is deprecated. But I don't know when they are going to turn it off (or if they already have). Here are docs for v2. I just made the switch on one of my sites and it was a pretty straight forward upgrade. https://developers.google.com/recaptcha/docs/faq – mr rogers Aug 06 '15 at 17:51

0 Answers0