Hallo,
I want to validate an email address field with my custom function but only when the built in validation rules ‘required’ and ’email’ are passed. My function verify if the email really exist and it need a bit of time to execute and it costs. Is there a way to catch the validation result of a build in rules like ’email’?
My code is:
jQuery('#pps_data').jqxValidator({
hintType : 'label',
rules: [
{ input: '#mail', message: 'Email is required!', action: 'blur', rule: 'required' },
{ input: '#mail', message: 'Email not valid!', action: 'blur', rule: 'email' },
{ input: '#mail', message: 'This email does not exist!', action: 'blur', rule: function (input, commit) {
var mailToChk = jQuery('#mail').val().trim() ;
jQuery.ajax({
url: "my-verify.php",
type: 'POST',
data: { mail: jQuery('#mail').val().trim(),
name_surname: jQuery('#name_surname').val()
},
success: function(data)
{
if (data == "true")
{
commit(true);
}
else commit(false);
},
error: function()
{
commit(false);
}
});
}
},
]
});
Thanks for any suggestion,
Nicoletta