Thanks Spike, I'll give that a shot.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Stephen Milligan
Sent: Monday, June 21, 2004 3:43 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] anyone able to explain why I'm getting this
CFC-related error message?
When you are inside a custom tag, you are referencing the Variables scope of
the calling page when you use the Caller scope, so your code should look
like this:
Caller.Blah.args = structNew();
if ( Attributes.SomeID IS NOT "" ) {
Caller.Blah.args.Mode = "ThisID";
Caller.Blah.args.theID = Attributes.SomeID;
}
etc.
In other words, get rid of the variables scope declarations in the code.
Not sure why you're doing this rather than just passing the component as an
attribute. The component is passed by reference, so you'd get the same
result, but you wouldn't have to rely on knowing the name of the variable in
the calling page. In general it is a good thing if you only every pass data
into a component call, or custom tag rather than having it relying on the
context in which it is being used.
Spike
--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk
Do you cfeclipse? http://cfeclipse.tigris.org
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of David McCutcheon
>Sent: Monday, June 21, 2004 2:33 PM
>To: [EMAIL PROTECTED]
>Subject: [CFCDev] anyone able to explain why I'm getting this
>CFC-related error message?
>
>
>Hi.
>
>Pardon me in advance if I'm just being a moron and missing
>something simple,
>but here's what I'm running into:
>
>I have a method call inside of a custom tag that refers to a previously
>instantiated component (Variables.Blah) and related arguments
>(Variables.Blah.args) on the calling page (see below):
>
>Caller.Variables.Blah.args = structNew();
>if ( Attributes.SomeID IS NOT "" ) {
> Caller.Variables.Blah.args.Mode = "ThisID";
> Caller.variables.Blah.args.theID = Attributes.SomeID;
> }
>else {
> Caller.variables.Blah.args.Mode = "ThatID";
>Caller.variables.Blah.args.theID = Attributes.SomeOtherID;
> }
>Variables.Foo =
>Caller.Variables.Blah.getFoo(argumentCollection=Caller.Variable
>s.Foo.args);
>
>But, when this code executes I get the following CF error:
>
>** Cannot invoke method getFoo on an object of type
>coldfusion.runtime.Struct with named arguments.
>
>** Use ordered arguments instead.
>
>For reference purposes, here's the method itself:
>
><cffunction name="getFoo"...>
>
> <cfargument name="Mode" type="string" required="true">
> <cfargument name="theID" type="string" required="true">
>
> <cfquery name="instance.qGetFoo"...>
> SELECT
> <cfif arguments.Mode IS "ThisID">
> ThisStuff
> <cfelseif arguments.Mode IS "ThatID">
> ThatStuff
> </cfif>
> FROM Foo
> WHERE FooID = '#arguments.theID#'
> </cfquery>
>
> <cfreturn instance.qGetFoo>
></cffunction>
>
>So, anyone have an idea as to what's causing the error?
>
>Thanks for your time.
>
>- DM
>
>----------------------------------------------------------
>You are subscribed to cfcdev. To unsubscribe, send an email
>to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
>in the message of the email.
>
>CFCDev is run by CFCZone (www.cfczone.org) and supported
>by Mindtool, Corporation (www.mindtool.com).
>
>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'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
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'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]