Title: Message
Mike:
I like to see an example for this? if you have sometime to cook it up for us.
thanks
seng
-----Original Message-----
From: Dawson, Michael [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 11, 2005 11:49 AM
To: [email protected]
Subject: RE: [CFCDev] Form Validation

Do you use the setErrors/getErrors methods?  I've abandoned them for a more favorable method described below.  I'm wondering if I should release them as a tool kit. 
 
I use a totally-separate component for handling errors.  It's a small, simple object, but works great.  I would not use the "built-in" error methods you generate. 
It depends on how your bean is populated.  If I'm populating from a form, I'll usually set the data type to "any" for a date field to accept anything (unless I'm sure it's really a date - such has a js calendar event etc).  I use "any" to show a difference between plain old strings and something special being done in the validate. 
 
Good idea.  "Any" appears better than "String" for those values. "Any" seems more ambiguous which is exactly what form data is. 

> I usually just "catch" errors inside my validate function.  I don't consider the bean "good" until validation has been done anyways.  I have a special generic form error handler that I use to "hold" error codes on validation (error code, field name and location [the bean name] - it's easy to track down where errors are being set) and I pass in the errorHandler to the validate() method in which it returns the error handler.  I also have a errorMessage class that reads my errorHandler and outputs html with the correct message text for the error code inside a cfsavecontent for display on my form (I also have dev and production mode - so the output differs [i.e. more debug info]).
 
I use a similar method with the external error compoent. 
No problem...I don't pretend to have all the answers here and I'm open to suggestions on improvement.  I know that all forms are just strings anyways - I just don't think you have to have your bean be all strings too...  In the end, you have to fudge things a bit sometimes as well and it depends on how your UI is designed. 
 
Do you "ever" go from an "Any-typed" object to a correctly-typed object in a single process?  Or do you just leave it one way or another?
 
For example, you could have a formBean with "Any" datatypes.  Once that is validated, do you then pass the data into a fully-typed bean? 

Thanks!
M!ke
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to