Thor can now also handle client-side validation
I just updated my CFC based validation system called Thor with a jQuery example that shows how it can also handle client side validation.
Thor already does a solid job of validating user data on the server-side, but you may still need a solution for client-side validation. This can be difficult for many developers because it may require using two different validation systems. This means doubling the code to get any basic form up and running. And again, this can be difficult to manage and maintain.
Thankfully with some basic jQuery scripting, you can now make Thor handle client-side validations. One of the examples (should be Example 9) included with the Thor zip is one which handles client-side validation with the use of the popular JavaScript library, jQuery. The jQuery code will dynamically determine the form input elements on the page. As a user enters data in that input element and then tabs over to the next item, jQuery will do a simply POST call to ColdFusion which will then route that input data through Thor to see if it's valid. If it isn't, it will respond with the proper error code which jQuery will then display for the user.
This continuous client-side validation can be very handy if you have large html forms where it takes several minutes for the user to enter all the data. As they go through the process of entering data, they discover in 'real-time' if there are any problems. When the users gets to a submit button, they can be fairly certain that most if not all the data they have enter is correct. This can make the experience more enjoyable for the end user.
This process however can be very server chatty. So feel free to let me know how to it scales for your applications. The benefit of this is it's very easy to add on client-side validation and you can now have just one set of validation libraries that can handle both client and server side validation. There's no other ColdFusion based solution that I'm aware of that can handle this.
Bob Silverberg wrote on 04/12/097:48 PM
In response to "There's no other ColdFusion based solution that I'm aware of that can handle this", actually there is. Check out validatethis.riaforge.org.It takes a different approach to validations than Thor. One of its main features is that it generates both client-side and server-side validations from a single piece of metadata.