AndyJarrett

Model Glue Form Validation

I've been working on a app with a couple of forms and wanted to break the validation rules into different group of rules e.g.

1. Rules for address
2. Rules for personal information
3. Rules specific per form.

What this allows me to do is is per validation call in the controller just use the validators i need.

How I am doing it:

1. Create a controller called validator.cfc
2. Create you validation.cfc's i.e.
  1. validator_Personal.cfc
  2. validator_address.cfc
  3. validator_other.cfc
Your validation cfc's should look like this:

3. In validator controller create a listener which has calls the validator objects e.g.



4. To finish it off, in your form you need the usual viewState calls