JavaScript
  Home arrow JavaScript arrow Universal Form Validation
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Universal Form Validation
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 24
    2004-02-02

    Table of Contents:
  • Universal Form Validation
  • First, the Forms
  • Good Form, Jack!
  • Pick a Number, Any Number!
  • And Knowing is Half the Battle

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Universal Form Validation


    (Page 1 of 5 )

    We have witnessed the wonders of JavaScript and its ability to ensure that our forms are properly filled before submission. But it gets so laborious to type and modify and update form validation scripts for every for in every application. Take heart! Upon reading and applying the methods in this article, you will never again have to worry about client-side validation! Hazzah!

    The benefits of form validation cannot be over emphasized. To end-users, they can often be an annoyance. To developers, webmasters and DBAs, they are pure preventative medicine (ok, so they taste as bas as Dr. Buckley’s, but they work!). Without them our databases would be full of empty and incorrect fields, and our applications constantly spewing out gross errors due to someone’s lack of form-filling motivation.

    To respond to our pleas, many websites have posted many articles, examples, and ‘cut & paste’ scripts that we can slap onto a form to have it scrutinize a user’s every move. Thanks to JavaScript, forms can become somewhat more reliable within our applications.

    A tutorial for form validation can be found here. And this would suit a site well if all you have is one or two forms. But managing validation becomes a rather onerous task when you have a contact form, an event registration form, a sign in form, and so on and so forth.

    Microsoft saw this coming, and they included a nice method of form validation within the .NET framework. The disadvantage there is that you’re still typing in validation code for each field in all of your forms. And what if you’re just not using .NET, what if you’re not even using any dynamic technology? Is there any easy way to validate all forms, once and for all?

    Clearly this article wouldn’t exist were there not. So, I’m going to explain in gory detail two important and reusable methods: one for checking valid form data, the other for ensuring the proper data type is being entered.

    More JavaScript Articles
    More By Justin Cook


       · If you are not experienced in javascript, dont try to copy/paste the code and expect...
     

    JAVASCRIPT ARTICLES

    - Comparing Fields and Customizing Error Messa...
    - Checking Numbers and File Extensions with jQ...
    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek