Validation plugin, remote validation misuse or bug?
Hi. I'm trying to do an ajax verification on the email field. The problem appears when the email field (on error, "email@example.com is already in use") is re-focused: the error message becomes malformed ("http://w/index.php?dispatch=auth.check_email is already in use").
Screenshots:
- input focused, email checked, the error message appears as expected:
- input refocused, without changing it's value, the error message is now malformed:
...after few research with firebug I've found that [object Object] is actually the rule 'object' (like below, {"url": "http://..", "type": "get"}) and not the error message itself.
I have the following code:
- JS:
$(document).ready(function() {
var registration_form = $("#registration-form").validate({
rules: {
email: {
required: true,
email: true,
remote: {
url: "http://w/index.php?dispatch=auth.check_email",
type: "get"
}
}
},
messages: {
email: {
required: "Field required",
minlength: "Field field",
remote: jQuery.format("{0} is already in use")
}
}
});
$('#reset_registration_form').click(function() { registration_form.resetForm(); return false; });
- PHP (http://w/index.php?dispatch=auth.check_email):
- echo User::email_exists($_REQUEST['email']) ? "false" : "true";
Any suggestions? Is this is bug or I just screw the plugin's configuration? Thank you :)