I want to validate a string which can be an email or multiple emails separated by commas.
For example:
bill.gates@hotmail.com -> TRUE
bill -> FALSE
I used validationEngine and underscore.js to do this:
function validateEmail(field, rules, i, options) {
if (!_.all(field.val().split(","), function(candidate) { return $.trim(candidate).match(options.allrules.email.regex); } ))
return options.allrules.email.alertText;
}
And then decorated my form field with: