function validate(email) {
var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return reg.test(email);
}
Here you need to pass the email address as parameter.
function validateEmail(sender, args) {
var isValid = 1;
var strEmails = document.getElementById("<%= txtEmailAddress.ClientID %>").value;
var emails = strEmails.split(";");
for (i = 0; i < emails.length; i++) {
if (!validate(trim(emails[i]))) {
isValid = -1;
break;
}
}
if (isValid == -1) {
args.IsValid = false;
}
else {
args.IsValid = true;
}
}
txtEmailAddress is the rich text box. This function is the asp custom validator function
var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return reg.test(email);
}
Here you need to pass the email address as parameter.
function validateEmail(sender, args) {
var isValid = 1;
var strEmails = document.getElementById("<%= txtEmailAddress.ClientID %>").value;
var emails = strEmails.split(";");
for (i = 0; i < emails.length; i++) {
if (!validate(trim(emails[i]))) {
isValid = -1;
break;
}
}
if (isValid == -1) {
args.IsValid = false;
}
else {
args.IsValid = true;
}
}
txtEmailAddress is the rich text box. This function is the asp custom validator function
No comments:
Post a Comment