I'm stumped with something very simple here. I'm trying to return a
string created in cfsavecontent within a service and output it in my
view. For some reason, no matter what I do, it returns an empty
string. I've dumbed the code down to the barest of bare bones and it
produces the same behavior no matter what.
Inside my handler, I have a very simple event
<cffunction name="doSomething" access="public" returntype="void" output="false">
<cfargument name="event" type="coldbox.system.beans.requestContext"
required="yes">
<cfscript>
//Get references
var rc = event.getCollection();
rc.output = instance.myService.getAString();
event.setView("myservice/dspMain");
</cfscript>
</cffunction>
I'm injecting the service into my handler and all the functions show
up correctly. Within my service I wrote a very simple method:
<cffunction name="getAString" access="public" output="false"
returntype="string">
<cfscript>
var local = {};
</cfscript>
<cfsavecontent variable="local.outputvar">
this is some other text
</cfsavecontent>
<cfreturn local.outputvar />
</cffunction>
Then in my view I just do a cfdump on RC.
Now if I set the content via a cfset as in <cfset local.outputvar =
"this is some other text" it shows up fine when I dump RC. But inside
the cfsavecontent, nothing happens. The output is an empty string with
a length of 0. I'm pretty sure that cfsavecontent works fine within
functions so is it something about how Coldbox puts the data into the
request collection? I'm totally stumped here, this shouldn't be
difficult. Perhaps I'm missing something glaring.
CF 8 standard, Coldbox 2.6.2
Thanks,
Judah