Results 1 to 3 of 3

Thread: Multiple emails validation in one text box with comma

  1. #1
    Join Date
    Jan 2008
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Multiple emails validation in one text box with comma

    hi there..i need some help on this email validation. i got a text box, can let the users to input many email with the seprator comma(,) or this (. then how can i use the javascxript to do a validation for it? plz help..i duno how to code it. plz help on code.thanx alot

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You cannot use a (.) to separate email addresses because at least one (.) usually appears in an email address and more than one can as well.

    Email validation is best left to the server side, which would depend upon which server side language and mail routines you are using. Any javascript email validation would be just a 'front end' for that, and could be disabled by the user.

    If you have a function to validate email addresses, it can be used with a comma delimited string by splitting the string into an array and applying it to each item in the array.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Multiple emails validation in one text box with comma

    Use this java script

    and it is workink fine

    Code:
    <script language="JavaScript1.2">
    var testresults
    
    function checkemail()
    {
     //var str=document.validation.txtAnchorEmail.value
     var str=document.getElementById('ctl00_ContentPlaceHolder1_txtAnchorEmail').value;
     var filter=/^.+@.+\..{2,3}$/
    
     if (filter.test(str))
        testresults=true
     else 
     {
        alert("Please input a valid email address!")
        testresults=false
    }
     return (testresults)
    }
    </script>
    
    
    
    <script>
    function checkbae(){
    if (document.layers||document.all)
    return checkemail()
    else
    return true
    }
    </script>
    
    
    
    
    
    <asp:TextBox id="txtAnchorEmail" onBlur="return checkbae();"  runat="server" CssClass="frm_input"></asp:TextBox
    Last edited by Snookerman; 06-12-2009 at 03:56 PM.

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
  •