View Single Post
  #1 (permalink)  
Old March 9th, 2006, 01:21 AM
mat41 mat41 is offline
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default Validate multiple email addresses...

Hello JS ers

I use this code to validate an email address:
-------------------------------------
email=document.addUser.eMail.value;
var expression=/^([a-zA-Z0-9\-\._]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]{2,3})$/;
if(!(expression.test(email)) )
{
   alert("Please enter a valid email address (50 chars max)");
   document.addUser.eMail.select();
   document.addUser.eMail.focus();
   return false;
}
-------------------------------------

It works very nicely. I would help altering it to validate several addresses. These addresses wil come in the form of a commer delimites string from an <input type="text"> form element.

Im am no JS guy. I would appreciate some assistance.

TYIA

Wind is your friend
Matt
__________________
Wind is your friend
Matt
Reply With Quote