Hi,
This is my first time using Java code and I'd really appriciate it if someone helped me with this little problem. I have a registration form that has a Java script at the top to validate fields, I did the code for validating blanks and a verify password. There is one piece of code that I need, I want the "email" field to accept only e-mails that end with "@ut.edu". I've searched the net but couldn't find anything helpful. Here is the code for the entire page:
<BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">
<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;
}
if (document.frmUser.email.value == "")
{
alert ("You must enter an E-Mail Address");
return false;
}
if (document.frmUser.FirstName.value == "")
{
alert ("You must enter your First Name");
return false;
}
if (document.frmUser.LastName.value == "")
{
alert ("You must enter your Last Name");
return false;
}
if (document.frmUser.Password.value == "")
{
alert ("You must enter a Password");
return false;
}
else
return true;
}
-->
</SCRIPT>
<TITLE>Used College Books System - User Registration</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFF80">
<CENTER>
<%
If Request("Update") = "True" Then
Response.Write "<H1>Used College Books System<BR> Update User Registration</H1>"
Else
Response.Write "<H1>Used College Books System<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 " & _
"purchase an existing book, or sell your own books " & _
"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> </TD>
<TD>E-Mail Address:</TD>
<TD><INPUT TYPE="Text" NAME="email" VALUE="<%= Session("EMailAddress")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>First Name:</TD>
<TD><INPUT TYPE="Text" NAME="FirstName" VALUE="<%= Session("FirstName")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Last Name:</TD>
<TD><INPUT TYPE="Text" NAME="LastName" VALUE="<%= Session("LastName")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Phone Number:</TD>
<TD><INPUT TYPE="Text" NAME="PhoneNumber" VALUE="<%= Session("PhoneNumber")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD> <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">
<INPUT TYPE="RESET"></TD>
</TR>
</TABLE>
</FORM>
<HR>
<TABLE BORDER=0 WIDTH=100%>
<TR ALIGN=CENTER>
<TD WIDTH=25%><A HREF="BrowseListings.asp">Browse the listings</A></TD>
<TD WIDTH=25%><A HREF="Login.asp">Login</A></TD>
<TD WIDTH=25%>Register</TD>
<TD WIDTH=25%><A HREF="default.asp">Log-Out</A></TD>
</TR>
</TABLE>
</BODY>
</HTML>
Thanks a lot for your time!
- Thamer
This is my first time using Java code and I'd really appriciate it if someone helped me with this little problem. I have a registration form that has a Java script at the top to validate fields, I did the code for validating blanks and a verify password. There is one piece of code that I need, I want the "email" field to accept only e-mails that end with "@ut.edu". I've searched the net but couldn't find anything helpful. Here is the code for the entire page:
<BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">
<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;
}
if (document.frmUser.email.value == "")
{
alert ("You must enter an E-Mail Address");
return false;
}
if (document.frmUser.FirstName.value == "")
{
alert ("You must enter your First Name");
return false;
}
if (document.frmUser.LastName.value == "")
{
alert ("You must enter your Last Name");
return false;
}
if (document.frmUser.Password.value == "")
{
alert ("You must enter a Password");
return false;
}
else
return true;
}
-->
</SCRIPT>
<TITLE>Used College Books System - User Registration</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFF80">
<CENTER>
<%
If Request("Update") = "True" Then
Response.Write "<H1>Used College Books System<BR> Update User Registration</H1>"
Else
Response.Write "<H1>Used College Books System<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 " & _
"purchase an existing book, or sell your own books " & _
"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> </TD>
<TD>E-Mail Address:</TD>
<TD><INPUT TYPE="Text" NAME="email" VALUE="<%= Session("EMailAddress")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>First Name:</TD>
<TD><INPUT TYPE="Text" NAME="FirstName" VALUE="<%= Session("FirstName")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Last Name:</TD>
<TD><INPUT TYPE="Text" NAME="LastName" VALUE="<%= Session("LastName")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD>Phone Number:</TD>
<TD><INPUT TYPE="Text" NAME="PhoneNumber" VALUE="<%= Session("PhoneNumber")%>"
SIZE="40"></TD>
</TR>
<TR>
<TD> <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">
<INPUT TYPE="RESET"></TD>
</TR>
</TABLE>
</FORM>
<HR>
<TABLE BORDER=0 WIDTH=100%>
<TR ALIGN=CENTER>
<TD WIDTH=25%><A HREF="BrowseListings.asp">Browse the listings</A></TD>
<TD WIDTH=25%><A HREF="Login.asp">Login</A></TD>
<TD WIDTH=25%>Register</TD>
<TD WIDTH=25%><A HREF="default.asp">Log-Out</A></TD>
</TR>
</TABLE>
</BODY>
</HTML>
Thanks a lot for your time!
- Thamer