Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2004, 07:22 AM
Authorized User
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 15 - EMail Validation

Ok..if currency aint your thing how about EMail Validation? :) On the register.asp page (code below), how do we make sure that only an email address is entered. we only need a very basic one - one that makes sure there is some text followed by '@' followed by some more text and a '.' ending with text eg 'com'. If for example [email protected] is entered we want the system to run as normal, but if Test is entered, we want a message to read please enter a valid email address. Much ike the message is shown for the password validation.

Thank you for any help you can offer:)

<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
  function VerifyData()
  {
    if (document.frmUser.Password.value != document.frmUser.VerifyPassword.value)
    {
      alert ("Your passwords do not match - please reenter");
      return false;
    }
    else
      return true;
  }

-->
</SCRIPT>

<TITLE>Going Going GONE!- User Registration</TITLE>
</HEAD>
<BODY BGCOLOR="#003399">
<BASEFONT FACE="Verdana" COLOR="#FF6600">
<BODY BGCOLOR="#003399" body bgproperties="fixed" background="backpic.jpg">
<p><img border="0" src="logo.bmp" width="50" height="50"></p>
<CENTER><a href="Default.asp"><img border="0" src="Home.png" width="120" height="19"></a><a href="login.asp"><img border="0" src="Login.png" width="120" height="19"></a><a href="Register.asp"><img border="0" src="Register.png" width="120" height="19"></a><a href="browselistings.asp"><img border="0" src="Browse.png" width="120" height="19"></a><a href="http://www.guistuff.com/"><img border="0" src="http://www.guistuff.com/images/11dot.gif" width="1" height="1"></a><CENTER>

<CENTER>
<%
  If Request("Update") = "True" Then
    Response.Write "<H1>Going Going GONE!<BR> Update User Registration</H1>"
  Else
    Response.Write "<H1>Going Going GONE!<BR> New User Registration</H1>"
  End If
%>
</CENTER>
<P>

<%

  If Request("Update") = "True" Then
    Response.Write "Please change your registration information as listed below<P>"
  Else
    If Request("NotFound") = "True" Then
      Response.Write "<I>We were unable to locate your information. " & _
                     "Please take the time to register again.</I><P>"
    Else
      Response.Write "<CENTER>(If you're already registered with us, " & _
                     "then click the 'Login' link below.)</CENTER><P>"
    End If
    Response.Write "You only need to register with our system if you want to " & _
                   "bid on existing 'for-sale' items, or sell your own items " & _
                   "on these pages. <BR> " & _
                   "In order to use these services, please take a few minutes " & _
                   "to complete the form below. Once you have done that, " & _
                   "you will have full access to the system."
  End If
%>
<FORM ACTION="AddUser.asp" NAME="frmUser" METHOD="POST"
              onSubmit="return VerifyData()">
  <TABLE BORDER=0>
    <TR>
      <TD WIDTH=20% ROWSPAN=11>&nbsp;</TD>
      <TD>E-Mail Address:</TD>
      <TD><INPUT TYPE="Text" NAME="email" VALUE="<%= Session("EMailAddress")%>"
           SIZE="40"></TD>



    </TR>
    <TR>
      <TD>Given Name:</TD>
      <TD><INPUT TYPE="Text" NAME="GivenName" VALUE="<%= Session("GivenName")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD>Family Name:</TD>
      <TD><INPUT TYPE="Text" NAME="FamilyName" VALUE="<%= Session("FamilyName")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD>Address:</TD>
      <TD><INPUT TYPE="Text" NAME="Address1" VALUE="<%= Session("StreetAddress1")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD></TD>
      <TD><INPUT TYPE="Text" NAME="Address2" VALUE="<%= Session("StreetAddress2")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD>City:</TD>
      <TD><INPUT TYPE="Text" NAME="City" VALUE="<%= Session("City")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD>County:</TD>
      <TD><INPUT TYPE="Text" NAME="County" VALUE="<%= Session("County")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD>Postal Code:</TD>
      <TD><INPUT TYPE="Text" NAME="PostalCode" VALUE="<%= Session("PostalCode")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD>Country:</TD>
      <TD><INPUT TYPE="Text" NAME="Country" VALUE="<%= Session("Country")%>"
           SIZE="40"></TD>
    </TR>
    <TR>
      <TD>&nbsp;<P>Password:</TD>
      <TD VALIGN=bottom><INPUT TYPE="Password" NAME="Password"
                         VALUE="<%= Session("Password") %>" SIZE="40"></TD>
    </TR>
    <TR>
      <TD>Verify Password:</TD>
      <TD><INPUT TYPE="Password" NAME="VerifyPassword" SIZE="40"></TD>
    </TR>
    <TR>
      <TD></TD>
      <TD ALIGN=CENTER COLSPAN=2><BR>
          <INPUT TYPE="Submit" VALUE="Submit Registration">
              &nbsp;&nbsp;<INPUT TYPE="RESET"></TD>
    </TR>
  </TABLE>
</FORM>



 
Old March 19th, 2004, 07:33 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Do you want this to happen server side or client side?

Try Google by searching for "validate e-mail address". You'd be surprised by the number of useful links.....


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 15 - ciwluke BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 11th, 2008 03:33 PM
email validation function keyvanjan ASP.NET 1.0 and 1.1 Basics 3 August 17th, 2006 05:30 PM
Unable to implement EMail as per Ch. 15 VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 February 28th, 2006 01:47 PM
Email validation problem mattastic Javascript How-To 1 May 19th, 2005 01:10 AM
email validation tysta JSP Basics 3 June 23rd, 2003 12:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.