0

ColdBox Variable

handlers/home.cfc

<cffunction name="index" output="false" hint="index">
    <cfargument name="event">
    <cfset rc.Test = 'This is a test 123.' />
    <cfset event.setView("home/index")>
</cffunction>

views/home/index.cfm

<cfdump var="#rc#" />

Why is rc.test not showing up in the dump?

1
  • Is it saying, "rc" is not defined" or is it saying "test is not defined in rc"? Dec 10, 2013 at 22:15

2 Answers 2

3

Without rc defined with cfargument, your rc.test will be set to variables.rc.test in your handler.

Do this:

<cffunction name="index" output="false" hint="index">
    <cfargument name="event">
    <cfargument name="rc">
    <cfargument name="prc">
    <cfset rc.Test = 'This is a test 123.' />
    <cfset event.setView("home/index")>
</cffunction>
0

You need to assign RC to Event.getCollection(). We do this at the top of every handler function.

<cffunction name="index" returntype="void" output="false">
    <cfargument name="event" required="true">
    <cfscript>
        var rc = event.getCollection();
        var prc = event.getCollection( private = true );

        // your handler code here

        Event.setView('home/index');
    </cfscript>
</cffunction>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.