Hello,

I am using the form validation plugin and I am stuck on the addMethod.
I have created a method using the addMethod function, in this I have
an ajax call to a server side page that validates the passed value.
Every thing works ok except I cannot figure out how to get the new
userNameInUse method I created to return true or false based on the
result of the ajax call.

here is my code...


jQuery.validator.addMethod( "userNameInUse",
                        function(value) {
                                $.ajax({
                                type: "GET",
                                url: "check.cfm",
                                data: "name=" + value,
                                complete: handleResults
                                });

                                function handleResults(r){
                                        //alert(r.responseText);
                                }

                                }, "That username is already in use, please 
enter a different
username");

Reply via email to