HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS 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 February 23rd, 2004, 12:48 PM
danosullivan danosullivan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 9 danosullivan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 10 sec
Reputation Power: 0
Javascript Generic Form validation

I have to implement a library of generic form validation tools, using Javascript, as described below.

isFieldFilledOut(field)

Function takes one argument, generally a submitted form field, and returns true if the

field has a real value (not NULL, EMPTY or “”) and false otherwise.

doFieldsMatch(fieldOne, fieldTwo)

Function takes two arguments, generally two submitted form fields - e.g.

doFieldsMatch(Request.Form(“password”), Request.Form(“passConfirm”)) – and returns

true if they are equal and false otherwise.

isFormFilledOut(HTTPMethod)

Function takes one argument defining the HTTP method used (GET or POST). Function

chooses the appropriate ASP Request collection based on the argument, and loops

through all submitted name=value pairs validating that all items have a real value (not

NULL, EMPTY or “”) Return true if the form is filled out, return false otherwise.

isEmailAddress(field)

Function takes one argument, generally a submitted form field, and returns true if the

field has a value valid for an internet email address and false otherwise. A valid email

address:

begins with one or more letters, numbers, underscores, hyphens or periods (full

stops)

contains exactly one at-sign (@) after that

continues with one or more letters, numbers, underscores, hyphens or periods (full

stops)

ends with a period (full stop) followed by 2 or 3 letters.

You can use pattern matching (regular expressions) or String methods to implement this

function.

fixURL(field)

Function takes one argument, generally a submitted form field, and corrects it to ensure it

is a valid web URL. Function returns the fixed URL.

If the first seven characters are not “http://” add those characters to the start of the

string.

Escape the string for URL encoding (use built in methods from your chosen

programming language)


Any ideas as to how I would go about this?
Thanks in advance.






s

Reply With Quote
  #2  
Old February 23rd, 2004, 02:51 PM
Memnoch's Avatar
Memnoch Memnoch is online now
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 7 h 3 m 32 sec
Reputation Power: 469
Smells like homework.

Reply With Quote
  #3  
Old February 25th, 2004, 01:34 AM
Bullschmidt's Avatar
Bullschmidt Bullschmidt is offline
Guru
ASP Free Novice (500 - 999 posts)
 
Join Date: May 2003
Location: USA
Posts: 885 Bullschmidt User rank is Sergeant (500 - 2000 Reputation Level)Bullschmidt User rank is Sergeant (500 - 2000 Reputation Level)Bullschmidt User rank is Sergeant (500 - 2000 Reputation Level)Bullschmidt User rank is Sergeant (500 - 2000 Reputation Level)Bullschmidt User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 9 h 44 m 12 sec
Reputation Power: 23
Maybe you can get some ideas from here:

Javascript Field Validations -- Client Side Scripting by Nannette Thacker - 8/19/1999
http://www.shiningstar.net/articles...tions.asp?ID=AW

Form Validation Using Javascript - 9/19/1998
http://www.4guysfromrolla.com/webtech/091998-1.shtml
Good tips such as saving JavaScript functions in a file called DataValidation.js and including this in pages that need this.
JavaScript functions.

WebDaily: Your daily source for Web Technology Tips and Tricks! - 10/27/1998
http://www.4guysfromrolla.com/webtech/102798-1.shtml
Just checks if fields filled in.

Form Validation Scripts
http://www.coolnerds.com/jscript/formval.htm
__________________
J. Paul Schmidt
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Javascript Generic Form validation


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 2 hosted by Hostway
Stay green...Green IT