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>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281864
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