SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Email Validation Script

    I have a question. My site generates email addresses for registered users. The email addresses look like this "John265Green@top.MYSITE.com" Can you please show me how to make email verification javascript for the following format

    1) All entered email addresses must contain "@top.MYSITE.com"

    2) The first part of the email address must be "(LETTERS)(3 Numbers)(LETTERS)@top.MYSITE.com"

    Thanks in advance for the help guys. I truly appreciate it!

  2. #2
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Below is the code I was using but want to be like this for when they enter their email address into the form. (LETTER)(3 NUMBERS)(LETTERS)@top.MYSITE.com

    Can you adjust the code below?

    Code:
    function validateForm()
    {
    var x=document.forms["myForm"]["email"].value;
    var atpos=x.indexOf("@");
    var dotpos=x.lastIndexOf(".");
    if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
      {
      alert("Not a valid e-mail address");
      return false;
      }
    }

  3. #3
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is very easy to do but no one is replying to this thread. I am only looking for an input form and script to validate that the input text is in this format "(LETTERS)(3 Numbers)(LETTERS)@top.MYSITE.com"

    I will pay for the code and input form. Thanks!

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by sellerscentral View Post
    Below is the code I was using but want to be like this for when they enter their email address into the form. (LETTER)(3 NUMBERS)(LETTERS)@top.MYSITE.com
    That would be the following regular expression:

    /[a-zA-Z]+\d{3}[a-zA-Z]+@top.MYSITE.com/
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,713
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by sellerscentral View Post
    Below is the code I was using but want to be like this for when they enter their email address into the form. (LETTER)(3 NUMBERS)(LETTERS)@top.MYSITE.com
    That would be the following regular expression:

    /[a-zA-Z]+\d{3}[a-zA-Z]+@top.MYSITE.com/
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •