0

Im trying to use the remote feature in the JQuery Validation Plugin to check to see if the email address exists. I cannot get it to return the status of it being registered. I am using the default php class provided. I am using Jquery Latest

Here is my class

<script type="text/javascript">
$.validator.setDefaults({
submitHandler: function() { alert("submitted!"); }});
$().ready(function() {

// validate signup form on keyup and submit
$("#form1").validate({
    rules: {
        user_pass: {
            required: true,
            minlength: 6
        },
        user_pass_confirm: {
            required: true,
            minlength: 6,
            equalTo: "#user_pass"
        },
        email: {
            required: true,
            email: true,
            remote: { url:"module/1.func.php",     
            type : "get",
            data : { email : function() { return $("#email").val();
 }, 
  }
  }        
        },

        terms: "required"
    },
    messages: {
        user_pass: {
            required: "Please provide a password",
            minlength: "Password must be at least 6 characters"
        },
        user_pass_confirm: {
            required: "Please provide a password",
            minlength: "Password must be at least 6 characters",
            equalTo: "Eenter the same password as above"
        },
        email: {
            required: "Enter your email address",
            email: "Enter a valid email address",


        },

        terms: "Please accept our policies"
    }
});

});

-----EDIT--ADDED 1.inc.php-----

$email = $_REQUEST['email'];
if($email=="[email protected]"){
$valid = 'false';
}else{
$valid = 'true';
}
echo $valid;
?>

-----EDIT--Changed Jquery-----

I have now changed the email rule to the following. I get "Please Fix this field" when the email is inputted if it matches.

email: { required: true, email: true, remote: "module/1.func.php" },

2
  • Post the code in your module/1.func.php. You aren't giving us anything to work with. Commented Apr 23, 2012 at 4:41
  • Are you using this plugin? docs.jquery.com/Plugins/Validation Commented Apr 23, 2012 at 5:03

1 Answer 1

1

Change your remote validator to

remote: "module/1.func.php"

It already sends the email via get and send that fields value.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.