I\'m using jquery validate plugin to validate an email address against a database using the remote method of this plugin.
I need to check the email address is not i
From what I can tell, this may be a limitation of the validate plugin. There are several options for triggering the validation (which is what you want to do) given at http://docs.jquery.com/Plugins/Validation/validate#toptions but I don't see a way to trigger validation on one element when another element changes.
Your best bet is to place your validation code in something like this:
$('select#siteid').onChange(function(){
$('form.validatedform').validate({
rules:{
email: {
required: true,
email: true,
remote: 'emailcheck2.asp?siteid=' + $('#siteid').val()
}
}
});
});
The plugin caches the value for performance reasons. As a workaround for now you could try to invalidate the cache manually whenever the dependent value changes:
$("#site").change(function() {
$("#email").removeData("previousValue");
});
Hi if you are using this jquery valdation plugin, http://docs.jquery.com/Plugins/Validation/validate
If you want to send additional parameters(e.g. siteid) for remote validation, you can do something like this:
var enquiryform = {
rules: {
email: {
required: true,
email: true,
remote: {
url: "emailcheck2.asp", //this should be the full path url including base url
data: {
siteid: function() {
return $('#siteid').val();
}
}
}
}
}
};