Here's my code....
imageCaption_183 is a dynamic field, I just removed the loop so it's a little bit easier to read.
I also have a try/catch around the whole block to trap system errors.
<!--- this works great --->
<cfset application.vt.AddRule(
objectType="content-image",
propertyName="imageCaption_183",
formName="imageCaption_183",
propertyDesc="Image Caption",
valType="required") />
<!--- this throws an error --->
<cfset var params = { minLength=5, maxLength=10 } />
<cfset application.vt.AddRule( theObject=arguments,
objectType="content-image",
propertyName="imageCaption_183",
formName="imageCaption_183",
propertyDesc="Image Caption",
valType="rangeLength",
parameters=params ) />
<!--- validate --->
<cfset result = application.vt.validate( theObject=arguments, objectType="content-image" ) />
<cfset status = result.getIsSuccess() />
<cfif ! status>
<cfset toReturn.status = status />
<cfset toReturn.error = result.getFailureMessagesByField() />
<cfelse>
<!--- save image --->
...
</cfif>
>> > validatethis+unsubscribe@googlegroups.com.
>> validatethis+unsubscribe@googlegroups.com.
> validatethis+unsubscribe@googlegroups.com.