I am having issues with reCAPTCHA 2 not working on my website form. The validation works, but once all required fields have been populated and the checkbox for agreeing to the T&Cs has been ticked, users can submit the form without ticking the 'I'm

359 views
Skip to first unread message

Rajesh Lakra

unread,
May 7, 2018, 6:47:01 AM5/7/18
to reCAPTCHA

I am having issues with reCAPTCHA 2 not working on my website form. The validation works, but once all required fields have been populated and the checkbox for agreeing to the T&Cs has been ticked, users can submit the form without ticking the 'I'm not a robot'.
Anyone help me please

Thanks

Praneesh P

unread,
May 16, 2018, 5:21:48 AM5/16/18
to reca...@googlegroups.com
hi,
  
  I think this code will working fine please check and inform me. 

<?php 
if(isset($_REQUEST['Submit'])) {
echo "Submitted".'<br/>';
}
?>
<!doctype html>
<html>
 <head>
  <title> Recaptcha validation using jquery ajax </title>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src='https://www.google.com/recaptcha/api.js'></script>
  </head>
  <body>


  <form id="add-conference" method="post">
  <table>
   <div class="container">
                <div class="form-group">
                    <div class="row">
                        <div class="col">
                            <input name="txt_password" id="txt_password" placeholder="Password" class="form-control f-4 m-wrap" value="" type="password">
                        </div>
                    </div>
                </div>
    </div>
   <input type="hidden" class="hiddenRecaptcha required" name="hiddenRecaptcha" id="hiddenRecaptcha">
   <div class="g-recaptcha" data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"></div>
   <input type="submit" value="Submit" id="submitAddForm" name="Submit">
  </table>
  </form>
 </body>
</html>


<script type="text/javascript">
$(document).on('click', '#submitAddForm', function (e) {
$("#add-conference").validate({
    ignore: ".ignore",
    rules: {
        txt_password: {required: true, minlength: 6},
       "hiddenRecaptcha": {
           required: function() {
               if(grecaptcha.getResponse() == '') {
                   return true;
               } else {
                   return false;
               }
           }
       }
   },

   messages: 
    {
    txt_password:      { required: "Please Enter Password", minlength: "Please choose a password with min length 6"},
    "hiddenRecaptcha": { required: "Captcha Required" }   
    },
});
});
</script>




--
You received this message because you are subscribed to the Google Groups "reCAPTCHA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to recaptcha+unsubscribe@googlegroups.com.
To post to this group, send email to reca...@googlegroups.com.
Visit this group at https://groups.google.com/group/recaptcha.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages