Seek some help with the jQuery form validation plugin if possible.
I check the email field of my form for blur by making an ajax call in my database, which checks if the text in the email field is currently in the database.
$('#sEmail').blur(function(){
var itemValue = $('#sEmail').val();
var emailData = {
sEmail: itemValue
}
$.getJSON('http://localhost:8501/ems/trunk/www/cfcs/admin_user_service.cfc?method=getAdminUserEmail&returnFormat=json&queryformat=column', emailData, function(data){
if (data != false) {
var errorMessage = 'This email address has already been registered';
}
else {
var errorMessage = 'Good'
}
})
});
What I would like to do is include this call in the rules of my jQuery validation plugin ... for example
$("#setAdminUser").validate({
rules:{
sEmail: {
required: function(){
}
},
messages:{
sEmail: {
required: "this email already exists"
}
});
Want to know if there are any achievements? Many thanks
source
share