私はお問い合わせフォームにvalidatejqueryプラグインとrecaptchaを使用していますが、エラーメッセージを送信しない場合は、フォームが送信される前にキャプチャのコードが正しいかどうかを確認する方法を知りたいです。とにかくフォームが送信される間違ったコード。これが助けのための事前の私のコードです
<script type="text/javascript">
var RecaptchaOptions = {
lang : 'en',
theme : 'custom',
custom_theme_widget: 'recaptcha_widget'
};
</script>
<form id="contact" method="post" action="#">
<fieldset>
<label for="name_contact">NAME</label>
<input type="text" class="input-xlarge" id="name_contact" name="name_contact" value="" placeholder="" minlength="2">
<label for="email_contact">EMAIL</label>
<input type="email" class="input-xlarge" id="email_contact" name="email_contact" value="" placeholder="">
<label for="telephone">CONTACT NUMBER</label>
<input type="tel" class="input-xlarge" id="telephone" name="telephone" placeholder="" value="" >
<label for="message">MESSAGE</label>
<textarea id="message" class="input-xlarge" name="message" placeholder="" rows="5"></textarea>
<div id="recaptcha_widget" style="display:none">
<div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>
<span class="recaptcha_only_if_image">Enter the words above:</span>
<span class="recaptcha_only_if_audio">Enter the numbers you hear:</span>
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
<div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div>
<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>
<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div>
<div><a href="javascript:Recaptcha.showhelp()">Help</a></div>
</div>
<script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=6Lf8RN4SAAAAAKnllVnDw23UpBIuAIdTRFgN1kmX">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lf8RN4SAAAAAKnllVnDw23UpBIuAIdTRFgN1kmX" height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
</noscript>
<button type="submit" value="" id="" name="send" class="pull-right lightblue btn-primary">SUBMIT</button>
</fieldset>
</form>
<script type="text/javascript">
$(document).ready(function () {
$("#contact").validate({
rules: {
"name_contact": {
required: true,
minlength: 3
},
"email_contact":{
required: true
},
"message":{
required:true
},
"recaptcha_response_field":{
required:true
}
},
messages: {
"name_contact": {
required: "Please, enter a name"
},
"email_contact":{
required: "Enter a valid email"
},
"message":{
required: "Please provide a comment"
},
"recaptcha_response_field":{
required: "Captcha is required"
}
},
errorPlacement: function(error, element) {
error.insertBefore(element);
}
});
});
</script>