The first session of the day and the first that had direct business relevance (as in “we’re going to be using this in about 2 weeks” relevant).
After missing the Railo Keynote due to the pressures of breakfast and an extra 10 minutes in bed I was in place for John’s session nice and early and I’m very glad I made the effort.
Validate This is one of the technologies that I’d looked at but not really got on board with, mostly because of the (incorrect) perception that it required you develop in OO ColdFusion to work.
Following a brief introduction to the Framework (jQuery) and the engines it supports (Adobe ColdFusion, Railo & Groovy) John proved my first assumption wrong – Validate This can be used to validate outside of objects using the FORM scope or even JSON calls as the basis for rule application. Oh and it supports jQuery 1.4 & 1.5.
John moved quickly onto the guts of the framework showing how a singleton instance of ValidateThis can be passed rules in XML or JSON via a parameter to the constructor of the base class.
For those using it in an OO environment, Validate This also supports annotations in the objects to be validated.
On the client side, standard validation messages are supplied which can be overridden as needed. The messages can be output in different locations by adding a <cfoutput /> to the code on the server-side.
A couple of other notes: Validate This currently uses isValidEmail() for email validation which is less than ideal as it’s a pretty basic ruleset but it can be easily overridden to employ your own regular expression.
One great feature that I wasn’t aware of is the support for “Contexts” in forms which allow you to use the same rule sets but apply some of them depending on the context of the data you’re validating. The example of “User Registration” vs “Login” form is a great way to promote a feature that really embodies the kind of DRY techniques that make this kind of framework worth using.
Other little tidbits? Of course JS is case-sensitive but having it raised as a gotcha was handy. As was the highlight of the “ignore” class which allows an item to be validated purely on the server-side (great for hidden fields).
Finally John pointed out that the validation instance can be injected back into the business object to provide access to validation from within the object itself … which is very cool indeed!
I’ll be working more with validate this over the next few weeks but this session was a great into.
(Note: John’s presentation is now online at http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/305 )
Scores (out of 10)
Direct Professional Value: 10
Ongoing General Value: 9
Contention / Debate (inv): 9
Style: 9
Overall: 9.25