Garrick Cheung

Sharing what I know and learn about CSS, MooTools, Javascript, PHP and etc.

MooTools.Floor Does Form Validation Right!

Posted on | October 22, 2008 | 1 Comment

We’ve all dealt with form validation one way or another and I didn’t find one to my liking. I was mulling over the idea of writing my own for a while and then I read Ajaxian’s blog today about a really awesome MooTools form validation class from MooTools.Floor. MooTools.Floor actually announced their FormCheck v1.4 form validation class in July 25, 2008.

MooTools.Floor was nice enough to post documentation for the class, though there’s a lot of options to go through.

Errors appear in tools tips, form submission via ajax is available, error messages can be customizable, the options are endless! Like I said, there are lots of options.

To set whether an input, textarea, or select element needs to validate, you give the element a class property:

1
<input type="text" class="validate['required','length[4, -1]','differs[email]','digit']" name="test_field" value="" />

To set up a form, you instantiate the MooTools class:

1
2
3
4
5
6
7
8
9
var myCheck = new FormCheck('form_id', {
    tipsClass : 'tips_box',
        display : {
            scrollToFirst : false
        },
        alerts : {
            required : 'This field is ablolutely required! Please enter a value'
        }
});

Screenshot of MooTools.Floor's FormCheck v1.4

Comments

One Response to “MooTools.Floor Does Form Validation Right!”

  1. David
    September 1st, 2009 @ 7:44 am

    +1 I’ve spent many hours over the years searching out and installing various client side form validation schemes, not to mention writing my own. .floor is the best I’ve seen. The slick notifications have gotten a number of ‘wows’ out of the clients… always a plus.

Leave a Reply





taking viagra woman Cheap Viagra
cheap gerneric viagra?