[thelist] Email Validator

Maryanna Nesina mar at MN1052.srv.pu.ru
Wed Dec 5 16:45:50 CST 2001


I agree with Shaun :)
my own variation for that perpouse sometimes ago was jast:


 if((err==0) && (((e.name=="emale") &&( (e.value.indexOf("\@") < 1) ||
((e.value.length)  (= (e.value.indexOf("\@")+ 1) ))))) err=1;
 // if e-male field and (&&) ( it doesn't contain @ or anuthing before @ or
(||) nothing goes after @)
    if (err == 1) break;
 }
   if (err==0) {
     return true;
   }

whrer var f - the Form name and  for (var i = 0; i < f.length; i++) {
                                                                 var e =
f.elements[i];
...

I think that the goal of JavaScript in this case is to help user if he
ocasionally do some mistakes, not to prevent him from submiting invalid
address.
If it's necessory we can go on checking on the server side (using dns ets.
ets.)
But the best way is to ask for e-mail confirming. (Thou I do undestend that
the Regex task itself was rather splended :)))

> As somebody with a .info domain, I'd like to mention that this validation
> won't let me enter my e-mail address.
>
> I've had a few sites tell me that my e-mail address isn't valid.  I
usually
> just make it username at shaunanderson.inf. I assume that some don't like it
> because it's a 4 letter TLD, and others because it isn't in their list of
> domains like the code below (pretty rare).
>
> Another problem with the code below would be people using country TLDs.
> It's a rather long list and you'd have to keep on top of it an make
changes
> as necessary. (pita)
>
> My personal opinion is that you should just make sure that there is an @
> sign, and a period after, with 2+ characters after the last "."  If
somebody
> doesn't want to give you a "real" e-mail address, they just need to enter
> asdf at asdf.com. It'll make it by any sort of validation you can through at
> it. The only way you're going to get a real address from some people is to
> tell them that you're going to give them what they want through e-mail.
> (username/password usually)
>
> Shaun
>
> > I wrote a email validation function (PHP) a long time ago. Don't know
how
> > upto date it is, but you might find it interesting :
> >
> > function checkEmail($address)
> >     {
> >     if(ereg( "^[^@
>
> ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)$",$ad
> dress)
> > )
> >     return true;
> >     else
> >     return false;
> >     }
> >
>
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list