What I am doing is want to validate comma-separated email addresses using Parsley.
I have worked out custom validator and triggered email fields, but I got a error for custom validator function.
window.Parsley.
addValidator(
'emails', {
requirementType: 'string',
validateString: function(val){
var email, emails, ret, i, len; ret = true;
for(i = 0, len = emails.length; i < len; i++) {
email = emails[i];
ret = ret && this.type(email, 'email');
}
return ret;
},
message: {
en: 'This value should be a email address'
}
});
Then I got error message:
Uncaught TypeErro: this.type is not a function
at f.validateString
at f.validate(parsley.min.js:9)
at _.validate
Anyone can help with this how to validate this email?