Home arrow JavaScript arrow Exception Handling in JavaScript: Validating forms Introduction

Exception Handling in JavaScript: Validating forms Introduction

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.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 8
October 04, 2005
  1. · Exception Handling in JavaScript: Validating forms Introduction
  2. · Setting the basics of form validation: defining custom error objects
  3. · Manipulating errors: defining custom error handling functions
  4. · Putting the pieces together: implementing the form validation script

print this article

Exception Handling in JavaScript: Validating forms Introduction
(Page 1 of 4 )

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.

blog comments powered by Disqus

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials