Have you tried calling the prepareText() method outside of the return?:

 <cfcomponent hint="Manages data interaction between the other methods and
the calling page" displayname="Module data manager">
        <cffunction name="getContent" access="public" returntype="string"
hint="The main method which manages all data interaction">
                <cfargument name="id" required="Yes" type="numeric">
                <cfset var getContent = "">
                <cfquery name="getContent"
dataSource="#APPLICATION.connect.DSN#"
username="#APPLICATION.connect.username#"
password="#APPLICATION.connect.password#">
                        SELECT *
                        FROM modules
                        WHERE id = <cfqueryparam value="#ARGUMENTS.id#"
cfsqltype="cf_sql_integer">
                </cfquery>
                <cfscript>
                        pt = this.prepareText(getContent);
                </cfscript>
                <cfreturn pt>
        </cffunction>
        <cffunction name="prepareText" access="private" returntype="string"
output="false" hint="I prepare and format text modules">
                <cfargument name="q" required="Yes" type="query">
                <cfset returnvar = ARGUMENTS.q>
                <cfreturn returnvar>
        </cffunction>
</cfcomponent>

Jim Rising
Sr. Cold Fusion Developer
ICGLink Inc.
www.icglink.com


-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 21, 2007 8:49 PM
To: CF-Talk
Subject: CFC "variable XYZ is not defined"

I'm working on some code which will make an AJAX call for an app. I keep
getting the following error:

Variable PREPARETEXT is undefined.

Eventually I'll be running this through javascript, but for the time being
I'm just trying to diagnose it. This is the URL I'm calling to test:
http://localhost/admin/ajax.cfm?method=getContent&id=6

I've tried calling prepareText directly and it works just fine. I also tried
calling another method from prepareText and got the same error. It's like my
methods can't see each other, but they're in the same CFC. I've tried
setting their access levels to all possible values but still the same error.
The getContent method is the only one which will ever be called directly.
All of the other methods will be private.

ajax.cm code
-----------------------
<cfset APPLICATION.cfc.data =
CreateObject("component","includes.data").init()>
<cfset myCFC = APPLICATION.cfc.data[URL.method]>
<cfoutput>!!!#myCFC(URL.id)#!!!</cfoutput>


data.cfc code
-----------------------
<cfcomponent hint="Manages data interaction between the other methods and
the calling page" displayname="Module data manager">
        <cffunction name="getContent" access="public" returntype="string"
hint="The main method which manages all data interaction">
                <cfargument name="id" required="Yes" type="numeric">
                <cfset var getContent = "">
                <cfquery name="getContent"
dataSource="#APPLICATION.connect.DSN#"
username="#APPLICATION.connect.username#"
password="#APPLICATION.connect.password#">
                        SELECT *
                        FROM modules
                        WHERE id = <cfqueryparam value="#ARGUMENTS.id#"
cfsqltype="cf_sql_integer">
                </cfquery>
                <cfreturn prepareText(getContent)>
        </cffunction>
        <cffunction name="prepareText" access="private" returntype="string"
output="false" hint="I prepare and format text modules">
                <cfargument name="q" required="Yes" type="query">
                <cfset returnvar = ARGUMENTS.q>
                <cfreturn returnvar>
        </cffunction>
</cfcomponent>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281866
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to