Validator – JavaScript Form Validator

OK so I said I would be releasing some of the tools I’ve developed over time to the general public. Well here is the first one: Validator.

It is a JavaScript (not that you’ll have to write hardly any of it) form validator. With just a one line of code to initialize it, and a couple of easy attributes to add to your form elements, you can have access to 23 (yes count them 23 – actually do count them I’m afraid of missing one or two) different types of validation for your form inputs.

I wrote Validator after not finding something that worked for me and what I was wanting. I found some that required specific server side languages to be used (not portable), others required complicated JavaScript initialization, or limited you to only specific browsers. I wanted something that just worked, and worked where ever I took it, regardless of the server or the clien’s browser. With that in mind, I developed a portable, customizable Form Validation Library that meets each of these goals, and then some. There are some advantages to using Validator over other methods:

  • Do not have to know JavaScript
  • Validates for many different types of input values
  • Validates different types of input forms, not just text fields.
  • Maintains separation of content (xhtml/html), display/style (CSS), and interaction (JavaScript) on the web page.
  • External JavaScript file so it can be cached and used on multiple pages efficiently.
  • Tested and works on Firefox 2, IE 6, and IE7. (Should work on others as well.)
  • Fully customizable error messages by setting attributes.
  • Fully customizable error styles by using CSS styles.
  • Good documentation on how to use it, and sample pages.

Feel free to check out the Validator Library and post comments and suggestions.

Note: As this is client side validation, it is possible for someone to skip the validation process entirely – so never rely solely on client side validation, always back-up your efforts with server side validation if possible. The client side simply keeps from having to perform too many round trip efforts in the validation process.

About Walter Wimberly

Walter is a strong believer in using technology to improve oneself and one's business.

Comments

  1. Nice website!!