SunQuest
 
       JavaScript
  Home arrow JavaScript arrow Exception Handling in JavaScript: Validati...
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  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
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

Exception Handling in JavaScript: Validating forms Introduction
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2005-10-04

    Table of Contents:
  • Exception Handling in JavaScript: Validating forms Introduction
  • Setting the basics of form validation: defining custom error objects
  • Manipulating errors: defining custom error handling functions
  • Putting the pieces together: implementing the form validation script

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Exception Handling in JavaScript: Validating forms Introduction


    (Page 1 of 4 )

    Here you have it. Welcome to the part four of the series “Exception handling in JavaScript.” Comprised of several parts, this tutorial introduces the usage of exceptions in JavaScript, by explaining the core concepts and demonstrating practical examples for fast application in numerous client-based programs.

    Over the previous parts of the series I presented some examples aimed at illustrating in a very friendly way, how errors triggered by user-provided input can be caught by generic error handlers and manipulated accordingly.

    In all the practical cases you saw, I used either a web form or a regular JavaScript prompt method for entering data, which was evaluated by the script. This is a helpful technique for trapping most of the primary error types. Of course, the only point worth noting here is the usage of the “try-catch” blocks for delegating error handling to specific pieces of code, while the rest of the program’s functions are focused on performing regular tasks within the execution of the program.

    So far, I’ve explored the nice capabilities of JavaScript exceptions by studying the topic from a didactical point of view, rather than implementing a “real world” example, which might be considered for use in production environments. Hopefully, now that you’ve got a fairly solid grounding about working with exceptions, the next step will be applying some of the concepts that you learned in an old favorite application: form validation.

    Throughout the rest of the article, I’ll explain through an illustrative example how exceptions can be used to perform client-side form verification. Even when this approach can be considered as an alternative method to regular form validating techniques, it’s worth it have a look at this implementation.

    With the preliminaries out of the way, let’s get going.

    More JavaScript Articles
    More By Alejandro Gervasio


       · The fourth part of the series implements an alternative method for performing...
     

    JAVASCRIPT ARTICLES

    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway