logo

New Response

« Return to the main article

You are replying to:

    • avatar
    • R
    • Posted on Sat 16 Feb 2008

    Add the below to the test procedure in order to validate basic email format multi-value separated by comma. Does not handle phrases RFC-822 :)~ Enjoy

    case "multiemail": var emailStr = f.value.trim(); if(emailStr == ''){return true}; //the field is allowed to be empty

    var mySplitResult = emailStr.split(","); var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid for(i = 0; i < mySplitResult.length; i++){ var testVal = mySplitResult[i].trim() +'';if ( !reg1.test( testVal ) && reg2.test( testVal ) ) { // this address passes } else {return false;} } return true; break;

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: