Multi Email Validation Class for Magento Prototype JS


Hi All,

Today i am going give the multi email validation class added to the form in magento prototype js. Some of the email fields need multi email features, But they dont know how to validate the multi email address using prototype javascript. Here is the code, Add it to any one of the js or customized js. Then put this “validate-multi-email” class to input fields like other validation classes.


/*
* Add Multi email validation to Default Prototype Validator Class
* return bool
*/
Validation.add('validate-multi-email','Please enter a valid email address. For example johndoe@domain.com.',function(emails){
emails = emails.split(',');
for(var i = 0;i<emails.length;i++){
if( Validation.get('validate-email').test(emails[i]) == false){
return false;
}
}
return true;
});

I hope some one can get this thing.

Thank you.