Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

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 May 13th, 2005, 05:28 AM
eeychi eeychi is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: davao city, philippines
Posts: 8 eeychi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 33 sec
Reputation Power: 0
Send a message via Yahoo to eeychi
Unhappy error checking in ASP

hi guys!! i have another problem in my coding... how can i add an error checking in my page?? because i have a customer registration page where a customer will input items the page... how can i have an error checking in the page, just like having an error like "username should not be more than 12 characters" or to have an error checking account like "the password you have entered is not the same" because there will be a field with "password" and "re-type password..." thanks everyone!!!
-eeychi

Reply With Quote
  #2  
Old May 13th, 2005, 08:57 PM
trubolotta trubolotta is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: Wheeling, IL
Posts: 171 trubolotta User rank is Private First Class (20 - 50 Reputation Level)trubolotta User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 Days 11 h 45 m 27 sec
Reputation Power: 4
You can use a client side event handler for validiation. Use the onsubmit event and check everything there. If you find an error, post an alert (or two) and cancel the event. You can also do server side validation but I don't like wasted trips to the server.

Reply With Quote
  #3  
Old May 14th, 2005, 01:24 AM
Hyrum R Hyrum R is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 133 Hyrum R User rank is Private First Class (20 - 50 Reputation Level)Hyrum R User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 15 h 19 sec
Reputation Power: 5
Further to what trubolotta said, a little bit of JavaScript is your friend. Here's just a simple page with two password fields and a JavaScript validation function. Hopefully this will give you an idea of what you need to do for the rest of your fields.

Code:
<html>
<head>
	<title>JavaScript Form Validation</title>
	<script language="JavaScript">
		function checkPassword()
		{
			if(document.myform.txtpass.value==document.myform.  txtconfirmpass.value)
			{
				alert("Your passwords match!");
				return true;
			}
			else{
				alert("Your passwords do not match!  Please re-enter!");
				return false;
			}
		}
	</script>
</head>

<body>
	<form name="myform" onsubmit="return checkPassword()" action="mypage.asp" method=post>
	<b>Password:</b><br>
	<input type=password name="txtpass"><br>
	<b>Confirm Password</b><br>
	<input type=password name="txtconfirmpass">
	<br>
	<input type=submit name="btnSubmit" value="Submit">
	</form>
</body>
</html>


You can also get fancy and use regular expressions to check if a valid email address or phone number has been entered without having to bother the server with a request.

Reply With Quote
  #4  
Old May 14th, 2005, 02:56 AM
Black&White's Avatar
Black&White Black&White is offline
Play up Pompey!
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Feb 2005
Location: Hampshire, ENG
Posts: 1,100 Black&White User rank is Second Lieutenant (5000 - 10000 Reputation Level)Black&White User rank is Second Lieutenant (5000 - 10000 Reputation Level)Black&White User rank is Second Lieutenant (5000 - 10000 Reputation Level)Black&White User rank is Second Lieutenant (5000 - 10000 Reputation Level)Black&White User rank is Second Lieutenant (5000 - 10000 Reputation Level)Black&White User rank is Second Lieutenant (5000 - 10000 Reputation Level)Black&White User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 9032 Folding Title: Novice Folder
Time spent in forums: 1 Week 1 Day 22 h 26 m 43 sec
Reputation Power: 62
In asp:
Code:
If len(username) > 12 then
response.write("Username too long")
end if

Reply With Quote
  #5  
Old May 14th, 2005, 04:32 AM
eeychi eeychi is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: davao city, philippines
Posts: 8 eeychi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 33 sec
Reputation Power: 0
Send a message via Yahoo to eeychi
thanks 4 d help guys!!!

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > error checking in ASP


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