Really Easy Field Validation with Mootools

UPDATE: this file is deprecated. See the validator script in our common code in the wiki.

Back in May I posted, er, recycled a post from Ajaxian about really easy field validation using Prototype (and Scriptaculous). I really liked this concept of field validation and, as I move through my current project of rewriting all the javascript on Download.com (pity me), I ran into a few validation tasks that made me think back to this post.

So I rolled up my sleeves and dove in to the code from Dexagogo and refactored it to work with Mootools, which is what we’re using as the foundation framework for our javascript efforts here at CNET (and to which I contribute).

I’ll post more about this later, but really there’s not much to post. The Documentation page at Dexagogo pretty much says it all - it’s the same functionality and the same API. I can’t really take any credit for this; it’s all Dexagogo’s magic.

Update: I left a few console.log statements in this when I posted it which broke it for some of you. It’s fixed now.
Download the script | Demo

11 Responses to “Really Easy Field Validation with Mootools”

  1. Andrew Tetlaw Says:

    Hey, cool stuff :)

  2. Steve Says:

    Cool. The demo isn’t working for me though (using Firefox 2.0.0.1, but I imagine you already tested with that so I’m not sure what’s up). BTW, most all of the validation regexes can be improved and/or shortened somewhat. I can try to work on this later if you’re interested.

  3. Aaron N. Says:

    I left a console.log statement in there; you’ll need to remove that (I’ll do it myself tomorrow).

    I didn’t write this library, just translated it. Valerio and I were already talking about writing something a little more flexible and a little less bulky. Feel free to change it however you like, or wait until we have something else to play with.

  4. My version of easy form validation » Clientside Says:

    [...] « Really Easy Field Validation with Mootools [...]

  5. Oli Says:

    I am still getting a few errors on your demo page and my own page testing out the toggle hyperlink and the radio buttons. This is using IE7 though…

    Any thoughts?

  6. Aaron N. Says:

    I updated this page; this version of the script is deprecated. See:

    http://clientside.cnet.com/wiki/cnet-libraries/03-jswidgets#validator.js

  7. Mike Says:

    I was just about to roll up my sleeves and do the same thing (convert Dexagogo’s stuff to Mootools) but you just saved me a ton of work good sir! Thank you!

  8. Mike Says:

    Great stuff! You definitely saved me a lot of time with this! One question, if I have a day (Sunday) which I need to disable, how could I go about doing this?

    Thanks so much!

  9. Aaron N. Says:

    Look in the docs (and look at the source) and see how you can write your own validators.

  10. webz Says:

    hi, i would like to ask if this is already compatible for v1.2.b2?
    well i just want to try to study it if to see if could create something which need for myself. I do hope you can give me thanks.

  11. Aaron N. Says:

    Yes. You can download it from our download page at http://clientside.cnet.com/js or from our svn repository.

Leave a Reply

You must be logged in to post a comment.