1. 程式人生 > >Edit type of email validation

Edit type of email validation

tex invalid mark sage [] 圖片 ret dex tps

技術分享圖片

function validate(value) {
if (value == null || value == ""){
return true;
}
if(value.indexOf(",")!=-1){
var arr=value.split(",");
var msg=[];
for(var j=0;j<arr.length;j++){
if(!isEmailValid(arr[j])){
msg+=arr[j];
if(j!=arr.length-1){
msg+=",";
}
}
}
if(msg.length>0){
return "Invalid email address:"+msg;

}else{
return true;
}
}else{
if (isEmailValid(value)){
return true;
}
else{
return new GwtMessage().getMessage("Invalid email address");
}
}
}

Edit type of email validation