Closed Bug 449758 Opened 16 years ago Closed 16 years ago

Regular Expression validation for email id fails for the second mail ID.

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 98409

People

(Reporter: manojkumarbestha, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

Regular Expression validation for email id fails for the second mail ID, 
When Java Script function  ValidateToEmailList is called the list of email ids one at a time is validated, by the Java script function echeck.
The echeck always returns false for the second email id passed even the second email id being valid.

The same function works returns true for second mail id in IE and Safari.


function ValidateToEmailList()
            {
                  var emailids = new Array("m.n@abc.com","k.k@abc.com");
                  for(i = 0; i < emailids .length; i++)
                  {
                        if (echeck(emailids [i])== false)
                        {
                              alert("Please enter valid email id(s)")
                              toEmailIds.focus()
                              return false
                        }
                  }
                  return true
            }
            function echeck(str) 
            {
                  var emailRegxp = /^[a-z0-9]([a-z0-9_\.\-])*\@(([a-z0-9])+(\-[a-z0-9]+)*\.)+([a-z0-9]{2,4})$/gi;
                  return emailRegxp.test(str);
            }


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Using new RegExp() instead of the regexp literal should fix this.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.