OK I am a little confused why you need everything to be dynamic.

If I wanted a polymorphic interface (one that is useful for more than one
related class) I would create different CFC instances depending on some
passed in parameter but would name the instance the same no matter which
actual CFC instance it was and then have it call a method name that was
applicable for all the related classes (thus making it polymorphic) and
then output it to the same variable.

That way the differentiation is in the CFC method not in my page.

I am curious why you are looking to make the whole thing dynamic.

Brendan









"Samuel Neff" <[EMAIL PROTECTED]>@cfczone.org on 06/17/2003 03:45:43 PM

Please respond to [EMAIL PROTECTED]

Sent by:    [EMAIL PROTECTED]



To:    <[EMAIL PROTECTED]>
cc:


Subject:    RE: [CFCDev] Dynamic CFC Calls



two ways,

1.


request.dataObj =  createObject("Component","Website/MyData");

varObj="dataObj";
varMethod="getStateData";// removed the parens
varName="someData";

variables[varName] =  request[varObj][varMethod]();

2.

<cfinvoke component="#request[varobj]#" method="#varMethod#"
returnVariable="#varName#">


Untested but both  should work.

hth,

Sam



-----Original Message-----
From: [EMAIL PROTECTED]  [mailto:[EMAIL PROTECTED] Behalf
Of Joe  Eugene
Sent: Tuesday, June 17, 2003 3:38 PM
To:  [EMAIL PROTECTED]
Subject: [CFCDev] Dynamic CFC  Calls


Anybody know how to dynamically call methods in  CFC's

<cfscript>
request.dataObj =  createObject("Component","Website/MyData");

varObj="dataObj";
varMethod="getStateData()";
varName="someData";


// Now, i want to be able to call the CFC Dynamically,  something like

'#varName#'=request["#varObj#"]["#varMethod#"];

//.#varMethod# doesnt work either.

</cfscript>

I am getting the below from the above code.
"Element getleftNavLinks is undefined in a Java object of  type class
coldfusion.runtime.TemplateProxy referenced as"

What am i missing?..

Thanks
Joe Eugene




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to