Luis Majano Forums Notification: Post to Form Validation

Title: RE: Form Validation
Thread: Form Validation
Forum: Need Help?
Conference: ColdBox
User: lmajano

You have an excellent point Oscar, especially when you are dealing with dates,
when you pass an empty string to a function requiring a date, then the call will

Internall, the beanfactory populates a bean by setter calls. If a
method is found in the cfc with the correct signature, it will call it and pass
as an argument the same value in the request collection. Example:

contains a method called 'setName( name:String )'

The factory will call the
setName() method and pass the 'name' value of the request collection into the

Your point of type mysmatches or invalid data give rise to an
interesting idea. What if by convention, the bean itself has a onPopulateError
method that could be called by the beanfactory if for some reason the setter
call fails. It can call the onPopulateError method on the bean itself and pass
in the exception. This method could then decide if its a real exception or if
its type mismatches, basically set the error property with the correct message
for the user and do clean validation. Am I just going totally funky here or no?
This is really something, this goes to something along the lines of an
onMissingMethod() that coldfusion 8 now immplements. You can dynamically morph
the bean to do validation or whatever by convention.

Ok, I think I over did
it, but what do you think?