0

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?

viscroad
  • 203
  • 2
  • 9

1 Answers1

0

It's not clear what you are expecting this.type(email, 'email') to be/do. this is the current validator object, probably not something you want to use.

Marc-André Lafortune
  • 78,216
  • 16
  • 166
  • 166