Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts

    debug check email function

    i'm using

    function checkemail(email){
    var str=email
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filter.test(str)){
    testresults=true
    }else{
    //alert("Please input a valid email address!")
    testresults=false
    }
    return testresults
    }


    and then checking -
    if (checkemail(form.C_EmailAddress.value)==false){
    errorMsg += "Email Address is not valid\r\n";
    error=1;

    }

    is there something wrong that i'm missing above???
    i'm getting an error in a function below.
    please advise.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    if (checkemail(form.C_EmailAddress.value)==false){

    C_EmailAddress.value is the value of the email address as input e.g. me@mydomain.com

    change to

    if (testresults == false) {

  • #3
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts
    no that doesn't have the value --


    if i do

    var testresults
    function checkemail2(email){
    var str=email
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filter.test(str)){
    testresults=true
    }else{
    //alert("Please input a valid email address!")
    testresults=false
    }
    return testresults
    }


    alert(checkemail2(form.C_EmailAddress.value));

    then I still get an error

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    Is 'form' the actual name of your form?

    It would help if you indicated what the message error is.


  •  

    Posting Permissions

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