tracker issue : CF-3039741

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 79537:(Watson Migration Closure)The validate & validateparams attributes of the cfproperty tag provide a way to do data validation

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Daniel Vega / Daniel Vega (DanVega)

Created: 08/23/2009

Components: ORM Support

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Platforms All

Vote Count: 3

Problem:

The validate & validateparams attributes of the cfproperty tag provide a way to do data validation.  There are a ton of ways provided using this approach to solving the hassles of validating data. I unfortunately think that in its current implementation its unusable.  The feature works like cfqueryparam works and will throw an error if the data being set in the setter does not validate. The only way to collect these errors is to wrap a try/catch around the caller set method. I think that another approach can be taken to enhance this. First off we can add a new attribute to the cfproperty tag named message. This will be the error message that is set when the data validation fails. When data validations fail they can get stored as an array of structs in the variables scope.  Each error would contain the property name, message and maybe a few other items. Then we can add our own getter for getErrors and retrieve the variables.errors instance. It would also allow us to write helper methods like hasErrors by checking the length of the array. Of course if these 2 methods were built in that would work even better! 
Method:


Result:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3039741

External Customer Info:
External Company:  
External Customer Name: Daniel Vega
External Customer Email: 0B25278F44609A949920157F
External Test Config: 08/23/2009

Attachments:

Comments:

This bug has been voted..
Vote by External U.
22994 | November 10, 2011 07:02:28 PM GMT
This bug has been voted..
Vote by External U.
22995 | November 10, 2011 07:02:29 PM GMT
Yes please, but do this as a UDF, not tied into the ORM. (see comments).
Vote by External U.
22996 | November 10, 2011 07:02:30 PM GMT