开发者

How to integrate the Jquery Validate Plugin with recaptcha?

Its kind of a boring, when you validate the entire form using Jquery Validate plugin in a quick way, but when it is about the recaptcha, you have to check it on the s开发者_如何转开发erver.

Can i use jquery validate plugin to check the recaptcha and show the messages, like it usually does for other fields?

Although, I dont know how to build it, may be a validate rule like required can be created for recaptcha, which can post the value to a page and get the response.


Guess remote is used for recaptcha validate

check it on here

perhaps you should have in your validation

 remote : 'someurl.php?someparams'

Complete code something like this

    rules:{
            username: {required: true},
            password: {required: true},
            email: {required: true, email: true},
            recaptcha: {required: true, remote: "someurl.php"},
            fullname: {required: true}},
    messages: {
            username: "Category name is required",
            password: "Password is required",
            fullname: "Full Name is required",
            recaptcha: {required: "captcha is required", remote: "Invalid captcha"},
            email: "Valid email is required"
        },      

On your remote url

<?php

echo "true";

//or 

echo "false";


No. The reCAPTCHA validation is done Google's servers and involves sending a private key (i.e. something that should never be placed in a publicly accessible location like JavaScript).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜