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  
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

Exception Handling in JavaScript: Validating forms Introduction
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 5
    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


    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

    - 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
    - Active Client Pages at the Server
    - ACP Tab Web Page







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT