Solved

Email validation problem

Posted on 1998-09-02
10
174 Views
Last Modified: 2008-02-26
Hi,

I am using FP98 for most of my web development. I am having trouble now with a javascript that I have placed on a contact form to validate whether or not an email address is valid. I can see no problems with the script so my guess is that the problem lies within the FP98 syntax that is associated with the form tags. If anyone has a work around to validate this form field I would love to know the solution.

Below is the the html for the page in question.

Many thanks, Michael mpg@acarrow.com

<html>

<head>
<title>Contact Confrad</title>
<meta name="Description"
content="Confrad International Contact Page. If you would like more information about Confrad International please visit our web site: www.confrad.com">
<meta name="Keywords" content="none, default">
</head>
<script LANGUAGE="JavaScript">
function isemailAddr(form) {
      var field = form.emailAddr;
      var str = field.value;
      if (window.RegExp) {
            var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
            var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
            var reg1 = new RegExp(reg1str);
            var reg2 = new RegExp(reg2str);
            if (!reg1.test(str) && reg2.test(str)) {
                  return true;
            }
            field.focus();
            field.select();
            return false;
      } else {
            if(str.indexOf("@") >= 0)
                  return true;
            field.focus();
            field.select();
            return false;
      }
}
// -->
</script>


<body background="images/bckgrnd.gif" bgproperties="fixed">
<div align="left">

<table border="0" width="501" cellspacing="0" cellpadding="10">
  <tr>
    <td width="201" valign="top" align="left"><h3 align="left"><img
    src="images/cntct_logo.gif" alt="Confrad International Logo" align="left" WIDTH="201"
    HEIGHT="122"></h3>
    </td>
    <td width="300"><img src="images/cntct_ani.gif" alt="Confrad Contact" WIDTH="300"
    HEIGHT="50"></td>
  </tr>
  <tr>
    <td width="201"><small><small><font face="Verdana"><a href="confrad_core.htm">Home</a></font></small></small></td>
    <td width="300"><p align="left"><font face="Verdana"><small><small>If you would like more
    information about CONFRAD International please complete this form and we will reply to
    your query as soon as possible. You can also email us directly <strong>@</strong></small></small>
    <small><small><a href="mailto:confrad@easynet.co.uk">confrad@easynet.co.uk</a><br>
    </small></small></font></p>
    <p align="left"><font face="Verdana"><small><small>Thank you.</small></small></font></td>
  </tr>
</table>
</div>

<table border="0" width="450" cellspacing="0" cellpadding="10">
  <tr>
    <td width="100" valign="top"></td>
    <td width="275"><form method="POST" name="Confrad International Information Form"
    action="--WEBBOT-SELF--">
      <!--webbot bot="SaveResults" startspan U-File="private/form_results.txt"
      S-Format="TEXT/PRE" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
      S-Email-Format="HTML/UL" S-Email-Address="mpg@acarrow.com" B-Email-Label-Fields="TRUE"
      B-Email-ReplyTo-From-Field="FALSE" S-Email-ReplyTo="Confrad International Web Query"
      B-Email-Subject-From-Field="FALSE" S-Email-Subject="Confrad International Web Query"
      S-Builtin-Fields="Date" U-Confirmation-Url="thank_you.htm" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot
      bot="SaveResults" endspan --><input type="hidden" name="userid" value="brgmn181"><div
      align="right"><p><font color="#0066CC" face="Verdana"><br>
      <small>Family Name: <input type="text" name="LName" size="20" tabindex="1"><br>
      <br>
      First Name: <input type="text" name="FName" size="20" tabindex="2"></small></font></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Organisation: <input
      type="text" name="Organisation" size="20" tabindex="3"><br>
      <br>
      Address: <input type="text" name="Address" size="20" tabindex="4" maxlength="30"></small></font></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>City:</small></font>
      <input type="text" name="City" size="20" tabindex="5"></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Post Code:</small></font>
      <input type="text" name="PostCode" size="20" tabindex="6"></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Country: </small></font><input
      type="text" name="Country" size="20" tabindex="7"><small><font color="#0066CC"
      face="Verdana"><br>
      <br>
      Telephone: <input type="text" name="Telephone" size="20" tabindex="8"><br>
      <br>
      Fax: <input type="text" name="Fax" size="20" tabindex="9"><br>
      <br>
      Email</font><font face="Verdana" color="#000000">*</font><font color="#0066CC"
      face="Verdana">: <input type="text" name="emailAddr" size="20" tabindex="10" value=" "></font></small></p>
      </div><div align="right"><p><font face="Verdana"><font color="#0066CC"><small>Message: </small><textarea
      rows="4" name="Message" cols="30" tabindex="11"></textarea><br>
      </font><br>
      </font><br>
      <input type="submit" value="Send" name="Submit"
      style="background-color: rgb(0,102,204); font-family: Arial; font-size: 10; color: rgb(255,255,255)"
      tabindex="12"> <input type="reset" value="Clear" name="Reset"
      style="background-color: rgb(0,102,204); font-family: Arial; font-size: 10; color: rgb(255,255,255)"
      tabindex="13"></p>
      </div><div align="right"><p><font face="Verdana" color="#000000"><small><small>(*
      Required)</small></small></font></p>
      </div>
    </form>
    </td>
  </tr>
</table>
</body>
</html>
0
Comment
Question by:acarrow
  • 4
  • 4
  • 2
10 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1270103
Add and onsubmit to your <FORM tag:
<form method="POST" name="Confrad International Information Form"
action="--WEBBOT-SELF--"
onSubmit="return isemailAddr(this)">

Michel
0
 

Author Comment

by:acarrow
ID: 1270104
I am sorry, maybe I need restate my question. I added the onsubmit tag and nothing happened. I have since changed the script and it still does not work. Please try again. Here is the revised syntax.

<html>

<head>
<title>Contact Confrad</title>
<meta name="Description"
content="Confrad International Contact Page. If you would like more information about Confrad International please visit our web site: www.confrad.com">
<meta name="Keywords" content="none, default">
</head>
<script LANGUAGE="JavaScript">
function validEmail(email) {
            invalidChars = " ></:,;"
            if (email == "") {
                  return false
            }
            for (i=0; i<invalidChars.length; i++) {
                  badChar = invalidChars.charAt(i)
            if (email.indexOf(badChar,0) != -1) {
                  return false
                  }
            }
            atPos = email.indexOf("@",1)
            if (atPos == -1) {
                  return false
            }
            if (email.indexOf("@",atPos+1) != -1) {
                  return false
            }
            periodPos = email.indexOf(".",atPos)
            if (periodPos == -1) {
                  return false
            }
            if (periodPos+3 > email.length)      {
                  return false
            }
            return true
      }
      function submitIt(form) {
            if (!validEmail(form.emailAddr.value)) {
                  alert("Invalid email address")
                  form.emailAddr.focus()
                  form.emailAddr.select()
                  return false
            }
            return true
      }
      // End hiding script -->
</script>


<body background="images/bckgrnd.gif" bgproperties="fixed">
<div align="left">

<table border="0" width="501" cellspacing="0" cellpadding="10">
  <tr>
    <td width="201" valign="top" align="left"><h3 align="left"><img
    src="images/cntct_logo.gif" alt="Confrad International Logo" align="left" WIDTH="201"
    HEIGHT="122"></h3>
    </td>
    <td width="300"><img src="images/cntct_ani.gif" alt="Confrad Contact" WIDTH="300"
    HEIGHT="50"></td>
  </tr>
  <tr>
    <td width="201"><small><small><font face="Verdana"><a href="confrad_core.htm">Home</a></font></small></small></td>
    <td width="300"><p align="left"><font face="Verdana"><small><small>If you would like more
    information about CONFRAD International please complete this form and we will reply to
    your query as soon as possible. You can also email us directly <strong>@</strong></small></small>
    <small><small><a href="mailto:confrad@easynet.co.uk">confrad@easynet.co.uk</a><br>
    </small></small></font></p>
    <p align="left"><font face="Verdana"><small><small>Thank you.</small></small></font></td>
  </tr>
</table>
</div>

<table border="0" width="450" cellspacing="0" cellpadding="10">
  <tr>
    <td width="275"></td>
    <td width="275"><form method="POST" name="Confrad International Information Form"
    onSubmit="return validEmail(this)" action="--WEBBOT-SELF--">
      <!--webbot bot="SaveResults" startspan U-File="private/form_results.txt"
      S-Format="TEXT/PRE" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
      S-Email-Format="HTML/UL" S-Email-Address="mpg@acarrow.com" B-Email-Label-Fields="TRUE"
      B-Email-ReplyTo-From-Field="FALSE" S-Email-ReplyTo="Confrad International Web Query"
      B-Email-Subject-From-Field="FALSE" S-Email-Subject="Confrad International Web Query"
      S-Builtin-Fields="Date" U-Confirmation-Url="thank_you.htm" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot
      bot="SaveResults" endspan --><input type="hidden" name="userid" value="brgmn181"><input
      type="hidden" name value="Validate Email"><div align="right"><p><font color="#0066CC"
      face="Verdana"><br>
      <small>Family Name: <input type="text" name="LName" size="20" tabindex="1"><br>
      <br>
      First Name: <input type="text" name="FName" size="20" tabindex="2"></small></font></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Organisation: <input
      type="text" name="Organisation" size="20" tabindex="3"><br>
      <br>
      Address: <input type="text" name="Address" size="20" tabindex="4" maxlength="30"></small></font></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>City:</small></font>
      <input type="text" name="City" size="20" tabindex="5"></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Post Code:</small></font>
      <input type="text" name="PostCode" size="20" tabindex="6"></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Country: </small></font><input
      type="text" name="Country" size="20" tabindex="7"><small><font color="#0066CC"
      face="Verdana"><br>
      <br>
      Telephone: <input type="text" name="Telephone" size="20" tabindex="8"><br>
      <br>
      Fax: <input type="text" name="Fax" size="20" tabindex="9"><br>
      <br>
      Email</font><font face="Verdana" color="#000000">*</font><font color="#0066CC"
      face="Verdana">: <input type="text" name="emailAddr" size="20" tabindex="10" value=" "></font></small></p>
      </div><div align="right"><p><font face="Verdana"><font color="#0066CC"><small>Message: </small><textarea
      rows="4" name="Message" cols="30" tabindex="11"></textarea><br>
      </font><br>
      </font><br>
      <input type="submit" value="Send" name="Submit " &quot;background-color:" rgb(0,102,204);
      font-family: Arial; font-size: 10; color: rgb(255,255,255)&quot; tabindex="12"
      style="background-color: rgb(0,102,204); color: rgb(255,255,255); font-family: Arial; font-size: 10">
      <input type="reset" value="Clear" name="Reset"
      style="background-color: rgb(0,102,204); font-family: Arial; font-size: 10; color: rgb(255,255,255)"
      tabindex="13"></p>
      </div><div align="right"><p><font face="Verdana" color="#000000"><small><small>(*
      Required)</small></small></font></p>
      </div>
    </form>
    </td>
  </tr>
</table>
</body>
</html>

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1270105
I am sorry - the first script was never executed - when I added the onSubmit, it validated the email address.

What exactly does not work??? The submit itself? Have you installed the frontpage extentions on the server?

Michel
0
 

Author Comment

by:acarrow
ID: 1270106
Here is the orginal html again. I have Front Page extensions installed. When I click on submit nothing happens.

Thanks,

Michael

<script LANGUAGE="JavaScript">
function isemailAddr(form) {
      var field = form.emailAddr;
      var str = field.value;
            if (window.RegExp) {
                  var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
                  var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
                  var reg1 = new RegExp(reg1str);
                  var reg2 = new RegExp(reg2str);
            if (!reg1.test(str) && reg2.test(str)) {
                  return true;
      }
                  field.focus();
                  field.select();
                  return false;
} else {
            if(str.indexOf("@") >= 0)
                  return true;
                  field.focus();
                  field.select();
                  return false;
      }
 
}
 
// -->
</script>
</head>

<body background="images/bckgrnd.gif" bgproperties="fixed">
<div align="left">

<table border="0" width="501" cellspacing="0" cellpadding="10">
  <tr>
    <td width="201" valign="top" align="left"><h3 align="left"><img
    src="images/cntct_logo.gif" alt="Confrad International Logo" align="left" WIDTH="201"
    HEIGHT="122"></h3>
    </td>
    <td width="300"><img src="images/cntct_ani.gif" alt="Confrad Contact" WIDTH="300"
    HEIGHT="50"></td>
  </tr>
  <tr>
    <td width="201"><small><small><font face="Verdana"><a href="confrad_core.htm">Home</a></font></small></small></td>
    <td width="300"><p align="left"><font face="Verdana"><small><small>If you would like more
    information about CONFRAD International please complete this form and we will reply to
    your query as soon as possible. You can also email us directly <strong>@</strong></small></small>
    <small><small><a href="mailto:confrad@easynet.co.uk">confrad@easynet.co.uk</a><br>
    </small></small></font></p>
    <p align="left"><font face="Verdana"><small><small>Thank you.</small></small></font></td>
  </tr>
</table>
</div>

<table border="0" width="450" cellspacing="0" cellpadding="10">
  <tr>
    <td width="275"></td>
    <td width="275"><form method="POST" name="Confrad International Information Form"
    onSubmit="return isemailAddr(this)" action="--WEBBOT-SELF--">
      <!--webbot bot="SaveResults" startspan U-File="private/form_results.txt"
      S-Format="TEXT/PRE" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
      S-Email-Format="HTML/UL" S-Email-Address="mpg@acarrow.com" B-Email-Label-Fields="TRUE"
      B-Email-ReplyTo-From-Field="FALSE" S-Email-ReplyTo="Confrad International Web Query"
      B-Email-Subject-From-Field="FALSE" S-Email-Subject="Confrad International Web Query"
      S-Builtin-Fields="Date" U-Confirmation-Url="thank_you.htm" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot
      bot="SaveResults" endspan --><input type="hidden" name="userid" value="brgmn181"><input
      type="hidden" name value="Validate Email"><div align="right"><p><font color="#0066CC"
      face="Verdana"><br>
      <small>Family Name: <input type="text" name="LName" size="20" tabindex="1"><br>
      <br>
      First Name: <input type="text" name="FName" size="20" tabindex="2"></small></font></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Organisation: <input
      type="text" name="Organisation" size="20" tabindex="3"><br>
      <br>
      Address: <input type="text" name="Address" size="20" tabindex="4" maxlength="30"></small></font></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>City:</small></font>
      <input type="text" name="City" size="20" tabindex="5"></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Post Code:</small></font>
      <input type="text" name="PostCode" size="20" tabindex="6"></p>
      </div><div align="right"><p><font color="#0066CC" face="Verdana"><small>Country: </small></font><input
      type="text" name="Country" size="20" tabindex="7"><small><font color="#0066CC"
      face="Verdana"><br>
      <br>
      Telephone: <input type="text" name="Telephone" size="20" tabindex="8"><br>
      <br>
      Fax: <input type="text" name="Fax" size="20" tabindex="9"><br>
      <br>
      Email</font><font face="Verdana" color="#000000">*</font><font color="#0066CC"
      face="Verdana">: <input type="text" name="emailAddr" size="20" tabindex="10" value=" "></font></small></p>
      </div><div align="right"><p><font face="Verdana"><font color="#0066CC"><small>Message: </small><textarea
      rows="4" name="Message" cols="30" tabindex="11"></textarea><br>
      </font><br>
      </font><br>
      <input type="submit" value="Send" name="Submit " &quot;background-color:" rgb(0,102,204);
      font-family: Arial; font-size: 10; color: rgb(255,255,255)&quot; tabindex="12"
      style="background-color: rgb(0,102,204); color: rgb(255,255,255); font-family: Arial; font-size: 10">
      <input type="reset" value="Clear" name="Reset"
      style="background-color: rgb(0,102,204); font-family: Arial; font-size: 10; color: rgb(255,255,255)"
      tabindex="13"></p>
      </div><div align="right"><p><font face="Verdana" color="#000000"><small><small>(*
      Required)</small></small></font></p>
      </div>
    </form>
    </td>
  </tr>
</table>
</body>
</html>

0
 

Author Comment

by:acarrow
ID: 1270107
Adjusted points to 120
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1270108
Nothing happens as in an invalid email address gets passed on to the server???

When I view the page in Netscape 4.06, the validation script correctly puts the cursor in the email field on an invalid or blank email and does not allow the form to be submitted (e.g. nothing happens) until I write a valid email address  - then it submits the form but gives an error because it does not understand action="--WEBBOT-SELF--". That

If you mean the form does not get submitted when the email is correct it must have something to do with the action not being set correctly - I do not like action="--WEBBOT-SELF--">
I would expect something like action="http://www.yourserver.com/formmail.asp">

Did you publish this page on a webserver that has the extensions installed or are you running from your harddisk without a personal server...

Michel
0
 
LVL 1

Accepted Solution

by:
myer earned 120 total points
ID: 1270109
I don't see anything relating to FrontPage that would stop this form.  Your troubles are all script-related.  The "--WEBBOT-SELF--" action will be intercepted by IIS+FP98 extensions when the form is posted.

For starters, your script uses RegExp, which shuts out any browser below 4th generation and means you should specify LANGUAGE="JavaScript1.2"; of course you might already know that.

You briefly posted a second version that would have worked on more browsers that used indexOf() syntax.

Below you will find your page with a cross-browser email validation routine.  The default action is javascript:void(0) (the form will post regardless, so you want a default that does nothing).  This requires the email field to pass validation in order to be posted (the script sets the action).  I tested this page on MSIE 4.01, Netscape 3.04 and Netscape 4.05.

I also added an appropriate FPI, since you are using style definitions.  Hope this works for you.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function validEmail(field) {
    var form = document.forms[0];
    url = field;
    if (url != null && url != "") {
        a = url.lastIndexOf("@");
        b = url.lastIndexOf(".");
        c = url.indexOf(":");
        d = url.indexOf("/");
        e = url.substring(0,a);
        f = e.indexOf("@");
        g = url.substring(a+1,url.length);
        h = g.indexOf("[");
        i = g.indexOf("]");
        j = g.indexOf("<");
        k = g.indexOf(">");
        l = url.substring(a+1,b);
        m = url.substring(b+1,url.length);
        n = url.substring(0,a);
        o = 0;
        if (a > b) {o++};
        if (c != -1) {o++};
        if (d != -1) {o++};
        if (f != -1) {o++};
        if (h != -1) {o++};
        if (i != -1) {o++};
        if (j != -1) {o++};
        if (k != -1) {o++};
        if (l.length < 3) {o++};
        if (m.length < 2) {o++};
        if (n.length < 1) {o++};
        if (o == 0) {                              document.forms[0].action="--WEBBOT-SELF--";
        }
        else {
            alert("You have entered an invalid email address!");
            document.forms[0].action = "javascript:void(0)";
            form.emailAddr.value = "";
            form.emailAddr.focus();
        }
    }
    else {
        alert("You may subscribe some other time.");
        url="";
    }
}
// -->
</SCRIPT>
     </head>

     <body background="images/bckgrnd.gif" bgproperties="fixed">
     <div align="left">

     <table border="0" width="501" cellspacing="0" cellpadding="10">
       <tr>
         <td width="201" valign="top" align="left"><h3 align="left"><img
         src="images/cntct_logo.gif" alt="Confrad International Logo" align="left"
     WIDTH="201"
         HEIGHT="122"></h3>
         </td>
         <td width="300"><img src="images/cntct_ani.gif" alt="Confrad Contact"
     WIDTH="300"
         HEIGHT="50"></td>
       </tr>
       <tr>
         <td width="201"><small><small><font face="Verdana"><a
     href="confrad_core.htm">Home</a></font></small></small></td>
         <td width="300"><p align="left"><font face="Verdana"><small><small>If you
     would like more
         information about CONFRAD International please complete this form and we will
     reply to
         your query as soon as possible. You can also email us directly
     <strong>@</strong></small></small>
         <small><small><a
     href="mailto:confrad@easynet.co.uk">confrad@easynet.co.uk</a><br>
         </small></small></font></p>
         <p align="left"><font face="Verdana"><small><small>Thank
     you.</small></small></font></td>
       </tr>
     </table>
     </div>

     <table border="0" width="450" cellspacing="0" cellpadding="10">
       <tr>
         <td width="275"></td>
         <td width="275"><form method="POST" name="Confrad International Information
     Form"
         onSubmit="validEmail(this.emailAddr.value)" action="javascript:void(0);alert()">
           <!--webbot bot="SaveResults" startspan U-File="private/form_results.txt"
           S-Format="TEXT/PRE" S-Label-Fields="TRUE"
     B-Reverse-Chronology="FALSE"
           S-Email-Format="HTML/UL" S-Email-Address="mpg@acarrow.com"
     B-Email-Label-Fields="TRUE"
           B-Email-ReplyTo-From-Field="FALSE" S-Email-ReplyTo="Confrad
     International Web Query"
           B-Email-Subject-From-Field="FALSE" S-Email-Subject="Confrad International
     Web Query"
           S-Builtin-Fields="Date" U-Confirmation-Url="thank_you.htm" --><input
     TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot
           bot="SaveResults" endspan --><input type="hidden" name="userid"
     value="brgmn181"><input
           type="hidden" name value="Validate Email"><div align="right"><p><font
     color="#0066CC"
           face="Verdana"><br>
           <small>Family Name: <input type="text" name="LName" size="20"
     tabindex="1"><br>
           <br>
           First Name: <input type="text" name="FName" size="20"
     tabindex="2"></small></font></p>
           </div><div align="right"><p><font color="#0066CC"
     face="Verdana"><small>Organisation: <input
           type="text" name="Organisation" size="20" tabindex="3"><br>
           <br>
           Address: <input type="text" name="Address" size="20" tabindex="4"
     maxlength="30"></small></font></p>
           </div><div align="right"><p><font color="#0066CC"
     face="Verdana"><small>City:</small></font>
           <input type="text" name="City" size="20" tabindex="5"></p>
           </div><div align="right"><p><font color="#0066CC"
     face="Verdana"><small>Post Code:</small></font>
           <input type="text" name="PostCode" size="20" tabindex="6"></p>
           </div><div align="right"><p><font color="#0066CC"
     face="Verdana"><small>Country: </small></font><input
           type="text" name="Country" size="20" tabindex="7"><small><font
     color="#0066CC"
           face="Verdana"><br>
           <br>
           Telephone: <input type="text" name="Telephone" size="20" tabindex="8"><br>
           <br>
           Fax: <input type="text" name="Fax" size="20" tabindex="9"><br>
           <br>
           Email</font><font face="Verdana" color="#000000">*</font><font
     color="#0066CC"
           face="Verdana">: <input type="text" name="emailAddr" size="20" tabindex="10"
     value=" "></font></small></p>
           </div><div align="right"><p><font face="Verdana"><font
     color="#0066CC"><small>Message: </small><textarea
           rows="4" name="Message" cols="30" tabindex="11"></textarea><br>
           </font><br>
           </font><br>
           <input type="submit" value="Send" name="Submit " &quot;background-color:"
     rgb(0,102,204);
           font-family: Arial; font-size: 10; color: rgb(255,255,255)&quot; tabindex="12"
           style="background-color: rgb(0,102,204); color: rgb(255,255,255); font-family:
     Arial; font-size: 10">
           <input type="reset" value="Clear" name="Reset"
           style="background-color: rgb(0,102,204); font-family: Arial; font-size: 10; color:
     rgb(255,255,255)"
           tabindex="13"></p>
           </div><div align="right"><p><font face="Verdana"
     color="#000000"><small><small>(*
           Required)</small></small></font></p>
           </div>
         </form>
         </td>
       </tr>
     </table>
     </body>
     </html>
0
 

Author Comment

by:acarrow
ID: 1270110
The script is working fine now. Thanks for your assistance and sorry that it took so long for me to sort out.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1270111
So you get another version of the same - I don't get it?!
The first page you displayed had a script that used regexp if available and tested for existence of @ if not - fine and crossbrowser and crossversion, but the script was never called!

I suggested an onSubmit and you said nothing happened when you clicked submit - I asked if that was not the intended purpose of the email test: do not submit with an invalid email address. You did not comment but accepted an answer containing a different script that alerted when the email was invalid - I am sorry - I could have whipped that up too, I just assumed you wanted YOUR script to work.

Hmmm... Anyway I am glad it works for you.

Michel

0
 
LVL 1

Expert Comment

by:myer
ID: 1270112
I was just trying to help him.

The real goal in this case was to get the user to enter a valid email address.  The third version of the script may have worked, but had two problems;

1. It didn't offer any prompt to the user to explain the problem so they could correct it.
2. It would only work on Netscape 4.

It is always wiser to use code that addresses the widest possible audience.  Since Michael at one point posted a completely different version with indexOf(), I presumed the specific script was not the issue, but the goal of successful email validation was.

I wasn't trying to step on anybody's toes, I was just trying to help Michael get his page going in a manner he wanted.  Sorry.

-myer
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now