SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Resource

Form Validation Made Easy


Sponsored Links
Developer's Paradise : Inside Technique :
Form Validation Made Easy
Submission by mack

Go to the resource:
Form Validation Made Easy

Add to Assistant

Short Description
Matthew applies advanced JavaScript techniques to create a powerful and reusable validation script.

Long Description
Matthew introduces advanced JavaScript techniques and applies them to a powerful and reusable form validation script. Learn how to take advantage of JavaScript expando properties, pseudo-events, custom event handlers, anonymous functions, and regular expressions.

A sample form and very useful validation script is available for download.

Author
Matthew Frank
Date/ Version
6/16/1999
Submission URL
http://www.SiteExperts.com/tips/functions/ts21/page1.asp
Submission Date
Jun 16,1999
Last Update
Sep 16,2000
 

Discussion and Rate this Resource
Overall Rating: 4.2

andjc on May 24, 2003 at 10:00:51 AMRating: 5

Very useful tutorial ! Using expando and regexp (I am a bash/perl shell script fan) is really the most efficient way to get rid of infinite if..then and friends in javascript. I've added your site to our communautary bookmark.

Thanx a lot.

 

mack on Jun 12, 2002 at 2:19:28 PMNo Rating

i hate to keep harping on this, but the result of this script is ease.  here is an example of validation code for one of my forms.  you can't convince me that this code is too much.

with (document.Form1){
 Company["DISPLAY-NAME"] = "Company Name";
 Company.REQUIRED = true;
 
 Title["DISPLAY-NAME"] = "Job Title";
 Title.REQUIRED = true;
 
 FirstName["DISPLAY-NAME"] = "First Name";
 FirstName.REQUIRED = true;
 
 LastName["DISPLAY-NAME"] = "Last Name";
 LastName.REQUIRED = true;
 
 Street1["DISPLAY-NAME"] = "Street Address";
 Street1.REQUIRED = true;
 
 City["DISPLAY-NAME"] = "City";
 City.REQUIRED = true;
 
 States["DISPLAY-NAME"] = "State";
 States.REQUIRED = true;
 
 Zip["DISPLAY-NAME"] = "ZIP Code";
 Zip.REQUIRED = true;
 Zip.ZIP = true;
 
 EMail["DISPLAY-NAME"] = "E-Mail Address";
 EMail.REQUIRED = true;
 EMail.EMAIL = true;
 
 Phone["DISPLAY-NAME"] = "Phone Number";
 Phone.REQUIRED = true;
 Phone.PHONE = true;
}
bod1467 on Apr 23, 2002 at 7:01:59 AMRating: 2

WOAH!! That's a LOT of code!.

Check out my JavaScript page @ www5.brinkster.com/hiflyer - I have a generic form checker there which is MUCH simpler than this.

Ian A.

mack on Apr 22, 2002 at 1:25:59 PMNo Rating

You are always free to discount the techniques presented here, but you'd probably be giving up easy implementation.  The code may look involved, but it's built to make validation setup simple:  What's simpler than setting a single attribute in HTML?  Whereas you write more and more code for increasingly large forms, no code is required using these techniques.

For those interested in updates, you can find the latest at http://groups.yahoo.com/group/validation/.

JerryNixon on Dec 5, 2001 at 11:58:04 AMRating: 3
man, this is complicated. doesit have to be so hard to do? it seems that the effort to program just a few validation techniques is faster than adapting this stuff. i did something similar on my site that i intended to make a generic validation tool - it is far less sophisticated, but a cool approach, if you are interested chk it out - http://jerrynixon.com/jerrynixon/vbscript/new/new_formVerifier.htm

More Ratings/ Comments


To rate and comment on a resource, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password

Copyright © 1997-2008 InsideDHTML.com, LLC. All rights reserved.