So, I'm working through Discovering CFC's and I'm on the chapter where it's
talking about the validator CFC. The book doesn't give you code to test the
validator, but I think it should just run if I create a task object and run
the new method, like so:

<cfset mytask = createobject('component', 'com.techspedition.CFCs.Task')>

<cfset mytask.new("This is the header.", "This is the maker.", "9/13/03")>

I'm getting an error saying that the method "validate" doesn't exist. Here's
the code in question from the task.cfc.
<cfset var v="CreateObject('component', 'Validator')">

  <cfset this.header = arguments.header>
  <cfset this.maker = arguments.maker>
  <cfset this.dateDue = arguments.dateDue>

  <cfreturn v.validate(this)>

AND, here's the code from Validator.cfc:
<cfcomponent hint="I am a validator">
 <cffunction name="validate" returntype="boolean" output="yes">
 <cfargument name="obj" required="yes">
 <cfset md= getMetadata(arguments.obj)>

 <cfloop from="1" to="#arraylen(md.properties)#" index="i">
 <cfset currentProp = med.properties[i]>
  <cfif NOT isdefined("obj." & md.properties[i].name)>
   <cfreturn false>
  </cfif>
  <cfif isdefined("currentProp.assert")>
   <cfif NOT evaluate(currentprop.assert)>
   <cfreturn false>
   </cfif>
  </cfif>

 </cfloop>
 <cfreturn true>
 </cffunction>
</cfcomponent>

Both are copied right out of the book.... Thoughts on why I'm getting the
error I'm getting?

Thanks.
-Deanna


---------------------------------------------------------
Deanna Schneider
UWEX-Cooperative Extension
Interactive Media Developer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137960
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to