I have a textarea field that a user can upload a CSV file to populate the field. I then need to validate each one..here is the code I have but no luck:
validateEmails = function(emailAddress){
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
return reg.test(emailAddress);
}
for (var i = 0; i < reciparr.length; i++) {
var postDataMiddle = "";
if (reciparr[i].length > 0){
if(validateEmails(reciparr[i]))
// Post my data here
else
{
//Show error
return false;
}
}
}
Any idea Ninjas??