This is the script i am using for validation of single email id
[HTML]<script language = "Javascript ">
/**
* DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby. com/dhtml/)
*/
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf (at)
var lstr=str.length
var ldot=str.indexO f(dot)
if (str.indexOf(at )==-1){
alert("Invalid E-mail ID")
return false
}
:) the exampe is right above in my previous post ... just call a function with the comma-seperated string as its input ... after the split just loop over the resuting array and call you validation for every emai-address:
[CODE=javascript]
function check_all(c_s_l ist) {
var arr = c_s_list.split( ',');
for (var i = 0, l = arr.length; i < l; i++) {
var adr = arr[i];
// your validation here - may be you need some
// adaptions to handle the errors for every address
echeck(adr);
}
}
[/CODE]
kind regards
Hi Dude, whether pradeep jain & pradeep new are the first name and last name of the person who is having that mail id. You want to validate only the mail id not the name. If thats the case: have two arrays
ex: code
[HTML] var myArray1 = new Array();
var myArray2 = new Array();
var input = document.getEle mentById('textV al').value; //This has the pradeep jain:pradeep@ba c.com,pradeep new:new@abc.com
myArray1 = input.split("," );
for(i=0;i<myArr ay1.length;i++)
{
myArray2 = myArray1[i].split(":")
// myArray2[0] ----> contains the Name
// myArray2[1] -----> contains the Id to be validates;
validate(myArra y2[1]);
}[/HTML]
This is the way u can do it. If u have doubts post back it. I will try to help u out.
the user might enter as
name:name@abc.c om,nam1:name1@a bc.com or
name@abc.com,na me1@abc.com or
name:name@abc.c om,name1@abc.co m or
name@abc.com
this is the problem
See you have to maintain standards inprder top insist the user that this is my scope and this is my limitation or you have to use two logic and check before validating if the user has given the name then logic1 if the user name not given then logic2 you have to go by that. I would choose the first one rather than writing n no. of logics and complicating your code. Any further clarification post ur doubts
See you have to maintain standards inprder top insist the user that this is my scope and this is my limitation or you have to use two logic and check before validating if the user has given the name then logic1 if the user name not given then logic2 you have to go by that. I would choose the first one rather than writing n no. of logics and complicating your code. Any further clarification post ur doubts
Regards
Ramanan Kalirajan
ok .....so u mean to say 2 email ids seperated by a " , " is best for validation and security rite....can u please tell me how to check weather a " , " is there in string or not so that i can use the logic...
Comment