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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s