Tuesday May 4, 2010 8:04 AM
Word Count: 754
Last night I released v 0.71 of Hyrule I thought I would take a couple minutes to walk through a couple of the changes that were made.
So first off we have a bug with the display property. IF you have been paying attention you should of seen a bunch of examples that look kind of like this.
When we get an error it will display an error message based on the default message template which looks like "notempty=The field {display} must contain a value.". In the case above it will replace {display} with the @display property. This is all great but what if you don't have a display property. Well what it should do is use the property name. It was not doing this so I fixed that part. Then my friend Tony said why not just humanize the property name. Great idea so thats what we are going to do now. The following will do the same as the example above.
The next problem I came across on my own. Take the following example. Now if you fill nothing in for all 3 properties your going to get back 3 errors. The first 2 because they are still empty and the 3rd because your empty string does not follow the rules of a phone number
This was obviously a problem. What if you just wanted to validate that if the user did enter a phone number that it was valid. It was because of this for validators like phone,ssn,credit card,etc... that we now check to make sure the property is not empty before we validate it. If you want to make sure the phone number has something in it and that its a phone number then you can do the following.
There were some other minor changes but that was the bulk of it. All of the unit tests were also updated to contain a testIsBlankReturnsTrue method. Let me know your thoughts on all of this and feel free to join the Google Group.
Sunday May 2, 2010 8:08 PM
Word Count: 54
I thought I would take a few minutes and walk through my open source validation framework for ColdFusion. Below is a video that gives you a brief overview on the framework and I also walk though a couple examples. If you have any feedback on the framework, please let me know.
Friday April 30, 2010 8:03 AM
Word Count: 440
I am happy to announce that I have completely rewritten my Hyrule Validation framework. Thanks to some really great feedback from Lance Staples & Aaron Greenlee I decided that some issues needed to be fixed. The more I got into the framework the more I realized that I was not happy with a lot of things. First off I was not happy with the rules engine. The rules we basically doing validation and supplying an error message. A rule should only do one thing and that is validate the data. This made it much easier to write unit tests again. The framework now comes complete with unit tests for all of the rules which makes it a whole lot easier to test.
So what is Hyrule? Here is a short description from the documentation.
Validation has always been a tedious process that I wanted to rid my self of. I have used various frameworks that are out and many iterations of my own. I don't think you can really use other frameworks until you understand the problem and how the problem is solved. With that In mind I wanted to tackle my own validation framework. The idea for this framework really came from 2 sources. I really enjoyed the way the QuickSilver framework was using annotations in there framework so I thought I would do the same. The other source of inspiration was the hibernate validation frameowrk. That framework does the same thing for validation and many of my constraints, example and documentation text come from that framework.
Annotations are a very convenient and elegant way to specify invariant constraints for a domain model. You can, for example, express that a property should never be null, that the account balance should be strictly positive, etc. These domain model constraints are declared in the bean itself by annotating its properties. A validator can then read them and check for constraint violations
The plan is to write up many tutorials on how to use it. For now I just wanted to make everyone aware of the changes. Please download the framework and try it for yourself. Feedback like yours is priceless so anything you can provide would be a big help. Happy Validating!
http://hyrule.riaforge.org/
http://www.danvega.org/hyrule/docs/
Monday November 23, 2009 7:45 PM
Word Count: 214
In the last post we took a look at how to get started using the Hyrule validation framework. In this tutorial we will take a look at what constraints are and how they are the backbone of what this framework is trying to accomplish.
A constraint is a type of check or validation on a property. In the example from my last article we provided a constraint for the first and last name. The not empty is just one of many constraints available to you. This constraint just checks to make sure the data set for this property is not empty.
[More]
Monday November 23, 2009 12:31 PM
Word Count: 154
A couple days ago I blogged about validation in ColdFusion 9. Today I would like to walk you through a quick start of using Hyrule. The first thing you need to do is head over to RIAForge and download the project.
The Hyrule validation frameowrk can be installed a couple different ways. The easiest is to just drop the hyrule folder in to your webroot. If you do not wish to do that you can always drop it anywhere on disk or even in your project somewhere and then just create a mapping to it. With per application mappings this is very easy.
[More]
Saturday November 21, 2009 4:09 PM
Word Count: 430
As I have blogged about in Part I and Part II data validation is just not where it needs to be yet. I think Adobe has taken a nice stab at it but until some things change your probably going to need to roll your own or use a framework that already exists. Before we look at some potential solutions I want to take a look at some examples from outside of the ColdFusion world.
In the Java world when you use Hibernate there is a built in validation framework called Hibernate Validator. In your model you setup your constraints using annotations.
In grails you can setup constraints pretty easily.
In python (django) you can setup your constraints when you declare the property.
[More]