使用ReCaptcha和jquery验证脚本

时间:2015-06-03 17:55:58

标签: javascript php jquery validation recaptcha

我有一个表单,它使用query.validate.js在提交表单之前执行字段验证。它有效,但现在我正在尝试使用Recaptcha 2.0(很酷的一个,你只需点击一个按钮)。但是,提交表单时未检查ReCaptcha框。我假设他们在某种程度上相互冲突?

<head>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<form id="register" name="register" action="ce/ce_register_process.php" method="post" >

 <p>FIELD:<br/>
        <input id="field" size="40" name="field" type="text" required>
      </p>
<div class="g-recaptcha" data-sitekey="xxx"></div>

<input type="submit" value="Enter">

<script type="text/javascript">
    $().ready(function() {
        $("#register").validate({
            rules: {

                first: "required",
                last: "required",
                password: {
                    minlength: 5,
                    required: true  
                },
                password2: {
                    minlength: 5,
                    required: true,
                    equalTo: "#password"
                }

            }
        })
    });
  </script>

0 个答案:

没有答案