Posts Tagged ‘js’

MooTools form validation

Friday, October 30th, 2009

I was digging around in some old backup files of mine, and I happened to stumble across a form validation script I made for MooTools a while back. And I thought, hey, this is actually pretty neat. So I figured I should write up a simple test form for it and post it on my blog. In case anyone is intreseted in yet another form validator for MooTools :)

Basic usage is very simple. All that is needed in the example below is:

new FormHandler({form:'MyForm', identical:['f7', 'f8']});

Some of the features include;

  • Uses class names to specify which fields to validate
  • Email and number validation
  • Matching fields validation (Useful for password re-type fields)
  • Callbacks for onValid and onInvalid

Requires MooTools core 1.2.1 or later.

Here’s an example: (in an iframe)

Code can be downloaded here.