i have used System > Configuration > email field

i need to comma-separated validation.

we can validate single email with the help of validate-email but i need to use in comma separated fields.

enter image description here

any solution for system configuration comma-separated email validation ?


You can add custom validation class like below in your js file

Validation.add('validate-comma-separated-emails', 'Please enter a valid email address.', function(emaillist) {
    emaillist = emaillist.trim();
    if(emaillist.charAt(0) == ',' || emaillist.charAt(emaillist.length - 1) == ','){ return false; }
    var emails = emaillist.split(',');
    var invalidEmails = [];
    for (i = 0; i < emails.length; i++) { 
    var v = emails[i].trim();
        if(!Validation.get('validate-email').test(v)) {
    if(invalidEmails.length){ return false; }
    return true;

Now use validate-comma-separated-emails in your text field. Tested with magento admin panel, Output: enter image description here

  • thanks for your quick response, but one suggestion i need to check should not enter first character as comma or last character as comma. – denish vachhani Jan 30 '17 at 11:36
  • @denish , updated code. please check. – Jaimin Sutariya Jan 30 '17 at 12:25
  • thanks for your help, i will accept your answer. just need one small help. if i will add space in last this is not work for last or first character comma validation. – denish vachhani Jan 31 '17 at 3:12
  • @denishvachhani, You just have to trim the email lists. updated code. please check. – Jaimin Sutariya Jan 31 '17 at 6:01

You should be able to create own validation via js.


Anyway I found some solutions :) :
Using ajax validation for system configuration fields


  • thanks for help, but i need multiple email validation with comma separated. i have seen your links which only gives single email validation which not appropriate in my questions. Thanks again for your reply and valuable time. – denish vachhani Jan 31 '17 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.