Hi guys,
Here is the CFC code (sorry for that oversight):
<cfcomponent output="false" name="Test CFC" hint="This CFC is for
demonstrating issues with the ArgumentCollection and numeric types">
<cfset variables.instance = StructNew() />
<cffunction name="init" output="false" returntype="test"
hint="Initializes the object.">
<cfargument name="ID" type="numeric" required="true" />
<cfargument name="FirstName" type="string" required="true" />
<cfscript>
setID(Arguments.ID);
setFirstName(Arguments.FirstName);
</cfscript>
<cfreturn this />
</cffunction>
<cffunction name="setID" access="public" returntype="void"
output="false">
<cfargument name="ID" type="numeric" required="true" />
<cfset variables.instance.ID = Trim(Arguments.ID) />
</cffunction>
<cffunction name="getID" access="public" returntype="numeric"
output="false">
<cfreturn variables.instance.ID />
</cffunction>
<cffunction name="setFirstName" access="public" returntype="void"
output="false">
<cfargument name="FirstName" type="string" required="true" />
<cfset variables.instance.FirstName = Trim(Arguments.FirstName) />
</cffunction>
<cffunction name="getFirstName" access="public" returntype="string"
output="false">
<cfreturn variables.instance.FirstName />
</cffunction>
<cffunction name="getSnapShot" returntype="struct">
<cfreturn variables.instance />
</cffunction>
</cfcomponent>
As you can see, I have the ID set to numeric, and the Firstname set to
string, as they're defined in the recordset. I'm passing in an
ArgumentCollection, not a single argument, so the types on the <cfargument>s
are completely correct...
Dan
On 1/4/07 4:32 PM, "Christopher Jordan" <[EMAIL PROTECTED]> wrote:
> Daniel,
>
> I looked at the code on your blog, and having the code to the CFC would
> be a bit more helpful. My guess is that you've got a cfargument tag in
> your cfc that has it's type set to numeric instead of struct. Without
> the code it's hard to tell.
>
> Cheers,
> Chris
>
> Daniel Short wrote:
>> Hi,
>>
>> I have a blog post which details my problem here:
>>
>> http://www.dansshorts.com/?day=1/4/2007#blog360
>>
>> What's happening is that if I take a recordset row, and build a structure
>> based on it's columns, and then pass that structure as an ArgumentCollection
>> to a CFC, the method tosses a "not of type numeric" on a value that is
>> indeed numeric.
>>
>> Has anyone else seen a problem like this? The only way around it has been to
>> set the type to "any" and then just accept any old crap that someone wants
>> to pass in.
>>
>> Thanks,
>>
>>
--
Daniel Short
Web Application Architect
lynda.com, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265712
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4