Mar 11th 2009 × mootools 1.2 form validations, input masks and updates to .more
Just a round-up. First off, Aaron Newton announced yesterday on the mootools blog that the new mootools-more has been released (as RC1) on the mootools site. It features updates, fixes and mostly, new additions that were previously unavailable outside of the CNET/Clientside libraries. This does not mean to say he lifted the CNET code and pasted it into the mootools repository – a lot of it has been refactored and fixed.
Second, in having to work with forms in a hurry recently, I went and played with 2 such mootools ‘plugins’ from my bookmarks (whilst I was avoiding having to reinvent the wheel and being lazy…)
mootools formcheck is a class-based semantic solution which relies on css classes to define a ruleset for each input field. For example: <input type=”text” class=”validate['required', 'length[4, -1]‘, ‘differs[email]‘, ‘digit’]” />. Pretty flexible and pretty cool, thumbs up from me and the idea of a hash based ruleset within the element’s class is just great.
mootools iMask by Fabio Nagao is something similar to formcheck, but it takes matters further. iMask actually attaches itself to the input element and helps the user populate their data as per a pre-set ‘mask’. The mask is just a patterned format that cannot be broken. In reality, it allows you to ask your user to enter really complex data blocks, for example, you can have a field that contains (+NN)-NNN-AZ, hyphens, brackets and plus sign included. The end-user can only enter numerics or alpha characters in their designated places. Check it out, it’s really impressive.