Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 21st, 2005, 02:31 PM
badboypolar badboypolar is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: San Diego
Posts: 195 badboypolar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 36 m 43 sec
Reputation Power: 5
Unhappy Javascript validator

Okay it worked until I add DoCustomValidation & "2.
They are checking that txtPassword and txtVPassword match and txtEmail and txtVEmail match. I probably wrote it wrong since I don't know Java. Any help would be great. Thanks.

Code:
 <<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
<!--#Include virtual="adovbs.inc"-->
<%
'Coookie check
If Request.Cookies("UserInformation")("Session") = "Valid" then
Response.Redirect("welcome.asp?Error=Logged%20in")
Else
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>New Account</title>
<style type="text/css">
<!--
.style2 {font-size: 10px; font-family: "Gill Sans MT"; }
.style4 {
 font-size: 24px;
 font-weight: bold;
 font-family: "Gill Sans MT";
}
.style6 {font-family: "Gill Sans MT"}
.style7 {color: #FF0000}
.style8 {font-family: "Gill Sans MT"; font-size: small; }
.style14 {color: #FF0000; font-family: "Gill Sans MT"; font-size: small; }
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->

<!-- Beginning of JavaScript for checking required fields and for checking that certain fields contain only digits. -->
function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.
if(NoneWithCheck(document.NewAccount.radTitle))
 { errormessage += "\n\nPlease select a title."; }
if(WithoutContent(document.NewAccount.txtFirstName  .value))
 { errormessage += "\n\nPlease type your first name in the \"First Name\" text field."; }
if(WithoutContent(document.NewAccount.txtLastName.  value))
 { errormessage += "\n\nPlease type your last name in the \"Last Name\" text field."; }
if(WithoutContent(document.NewAccount.txtAddress.v  alue))
 { errormessage += "\n\nPlease type your address in the \"Address\" text field."; }
if(WithoutContent(document.NewAccount.txtCity.valu  e))
 { errormessage += "\n\nPlease type your city in the \"City\" text field."; }
if(WithoutSelectionValue(document.NewAccount.selSt  ate))
 { errormessage += "\n\nPlease select your state from the state list."; }
if(WithoutContent(document.NewAccount.txtZip.value  ))
 { errormessage += "\n\nPlease type your zip code in the \"ZipCode\" text field."; }
if(WithoutContent(document.NewAccount.txtPhone.val  ue))
 { errormessage += "\n\nPlease type your phone number in the \"Phone Number\" text field."; }
if(WithoutContent(document.NewAccount.txtEmail.val  ue))
 { errormessage += "\n\nPlease type your email address in the \"Email\" text field. (i.e. name@domain.com)"; }
if(DoCustomValidation)
 { errormessage += "\n\nPlease re-verify your email address"; } 
if(WithoutContent(document.NewAccount.txtPassword.  value))
 { errormessage += "\n\nPlease type a password in the \"Password\" text field."; }
if(DoCustomValidation2)
 { errormessage =+ "\n\nPlease re-verify your password"; }
 
// Put field checks above this point.
if(errormessage.length > 2) {
 alert('NOTE:' + errormessage);
 return false;
 }
return true;
} // end of function CheckRequiredFields()

function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}
function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
 if(ss[i].value.length > 0) { return false; }
 }
return true;
}
function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
 if(ss[i].checked) { return false; }
 }
return true;
}
function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}
function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
 if(ss[i].selected) {
  if(ss[i].value.length) { return false; }
}
  
function DoCustomValidation () {
if (document.NewAccount.txtEmail.value) != (document.NewAccount.txtVEmail.value) {
 { return false; }
}
function DoCustomValidation2 () {
if (document.NewAccount.txtPassword.value) != (document.NewAccount.txtVPassword.value) {
 { return false; }
}
return true;
}
//-->
</script>
</head>
<body>
		  <tr>
	<td bgcolor="#990000" width='5'></td>
	<td valign="top" colspan='2' bgcolor="#EEEEEE"><div align="center">
	  <form name="NewAccount" method="post" action="processaccount.asp" onSubmit="return CheckRequiredFields()">
		<table width="75%"  border="1" cellspacing="1" cellpadding="1">
  <caption class="style15">&nbsp;
					
					</caption>
		  <tr>
			<td class="style14"><div align="left">Title:</div></td>
			<td><div align="left" class="style8">
			  <input name="radTitle" type="radio" value="Dr.">
			  Dr.
			  <input name="radTitle" type="radio" value="Mr.">
			  Mr.
			  <input name="radTitle" type="radio" value="Miss">
			  Miss
	 <input name="radTitle" type="radio" value="Mrs.">
			  Mrs.
			  <input name="radTitle" type="radio" value="Ms.">
			  Ms.
			</div></td>
		  </tr>
	<tr>
			<td><div align="left"><span class="style14">First Name:</span></div></td>
			<td class="style8"><div align="left">
			  <input name="txtFirstName" type="text" id="txtFirstName" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td><div align="left"><span class="style14">Last Name: </span></div></td>
			<td class="style8"><div align="left">
			  <input name="txtLastName" type="text" id="txtLastName" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td><div align="left"><span class="style14">Address:</span></div></td>
			<td class="style8"><div align="left">
			  <input name="txtAddress" type="text" id="txtAddress" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td><div align="left"><span class="style8">Address2:</span></div></td>
			<td class="style8"><div align="left">
			  <input name="txtAddress2" type="text" id="txtAddress2" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td class="style14"><div align="left"><span class="style8">City:</span></div></td>
			<td class="style8"><div align="left">
			  <input name="txtCity" type="text" id="txtCity" value="San Diego" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td class="style14"><div align="left">State:</div></td>
			<td class="style8"><div align="left">
			  <select name="selState" id="selState">
				<option value="AZ">AZ</option>
				<option value="CA" selected>CA</option>
				<option value="NV">NV</option>
				<option value="OR">OR</option>
	   
			  </select>
			</div></td>
		  </tr>
		  <tr>
			<td class="style14"><div align="left"><span class="style8">Zip Code: </span></div></td>
			<td class="style8"><div align="left">
			  <input name="txtZip" type="text" id="txtZip" size="6" maxlength="5">
</div></td>
		  </tr>
		  <tr>
			<td class="style14"><div align="left">Phone Number: (8582923500) </div></td>
			<td class="style8"><div align="left">
			  <input name="txtPhone" type="text" id="txtPhone" size="15" maxlength="10">
			</div></td>
		  </tr>
		  <tr>
			<td><div align="left" class="style8">Fax Number: (8582923500)</div></td>
			<td class="style8"><div align="left">
			  <input name="txtFax" type="text" id="txtFax" size="15" maxlength="10">
			</div></td>
		  </tr>
		  <tr>
			<td class="style14"><div align="left">Email Address: </div></td>
			<td class="style8"><div align="left">
			  <input name="txtEmail" type="text" id="txtEmail" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td class="style14"><div align="left">Verify Email Address: </div></td>
			<td class="style8"><div align="left">
			  <input name="txtVEmail" type="text" id="txtVEmail" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td><div align="left"><span class="style14">Password:</span></div></td>
			<td class="style8"><div align="left">
			  <input name="txtPassword" type="password" id="txtPassword" value="" size="20" maxlength="20">
			</div></td>
		  </tr>
	<tr>
   <td class="style14"><div align="left">Verify Password: </div></td>
			<td class="style8"><div align="left">
			  <input name="txtVPassword" type="password" id="txtVPassword" value="" size="20" maxlength="20">
			</div></td>
		  </tr>
	<tr>
   <td class="style8"><div align="left">Association:</div></td>
			<td class="style8"><div align="left">			  <input name="txtAssociation" type="text" id="txtAssociation" size="30">
			</div></td>
		  </tr>
	<tr>
   <td class="style8"><div align="left">School:</div></td>
			<td class="style8"><div align="left">
			  <input name="txtSchool" type="text" id="txtSchool" size="30">
			</div></td>
		  </tr>
	<tr>
   <td class="style8"><div align="left" class="style8">Business:</div></td>
			<td class="style8"><div align="left">
			  <input name="txtBusiness" type="text" id="txtBusiness" size="30">
			</div></td>
		  </tr>
		  <tr>
			<td><div align="left">&nbsp;<input type="hidden" Name="Date" Value="<% = Date %>"></div></td>
			<td><div align="left">
				<input name="btnSubmit" type="submit" id="btnSubmit" value="Create Account">
				<input type="reset" name="Reset" value="Clear Form">
			</div></td>
		  </tr>
		</table>
	  </form>
	  

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Javascript validator


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT