CFSAVECONTENT in CFAJAX calls
When a multiline string is returned from a CF function used with CFAJAX, the engine seizes on the line breaks. This is easy to work around using ReReplace():
<cfset MyReturn = ReReplace(MyReturn,"[#CHR(10)##CHR(13)#]","","ALL")>
There is a second issue with CFSAVECONTENT specifically, in that the core CFAJAX include has this in it:
<cfsetting enablecfoutputonly="yes">
which means you need to add CFOUTPUT tags around your content inside the CFSAVECONTENT tag.
<cffunction name="TestSaveContent" returntype="string" output="true">
<cfset var MyReturn = "">
<cfset var MyString = "Hello">
<cfsavecontent variable="MyReturn">
<cfoutput>
<p>#MyString#</p>
<p>Goodbye</p>
</cfoutput>
</cfsavecontent>
<cfset MyReturn = ReReplace(MyReturn,"[#CHR(10)##CHR(13)#]","","ALL")>
<cfreturn MyReturn>
</cffunction>

There are no comments for this entry.
[Add Comment]