View comments | RSS feed
Contents > CFML Reference > ColdFusion Tags > cfsavecontent PreviousNext

cfsavecontent

Saves the generated content of the cfsavecontent tag, including the results of evaluating expressions and executing custom tags, in the specified variable.

Variable manipulation tags

<cfsavecontent 
variable = "variable name">
the content
</cfsavecontent>

cfcookie, cfparam, cfregistry, cfschedule, cfset

Attribute

Req/Opt

Default

Description

variable

Required

 

Name ofthe variable in which to save the generated content of the tag.

This tag requires an end tag.

You cannot use this tag to suppress output from a tag library.

The following example uses a custom tag to generate a report and saves the report in the variable CONTENT. It replaces all instances of the word "report" with the phrase "MyCompany Quarterly Report" and outputs the result.

<cfsavecontent variable="content">
   <CF_OutputBigReport>
</cfsavecontent>
<cfoutput>
   #replace(content, "report", "MyCompany Quarterly Report", "all")#
</cfoutput>

Contents > CFML Reference > ColdFusion Tags > cfsavecontent PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


wotg said on Nov 24, 2004 at 4:32 PM :
You will need to use <cfoutput> tags around the output that you are saving if you want to capture the variable values, instead of the variable names! This might be obvious to others, but it wasn't to me.
bizarrojack said on Jan 10, 2005 at 12:57 PM :
I just did an upgrade from CFMX 6,1,0,63958 to 6,1,0,83762.
I am getting "null pointer" errors when using cfsavecontent in certain situations; with the argument variable="variablename", this causes an error, but it didn't before.

When I change the syntax to
<cfsavecontent variable=variablename> (no quotes)
Now it works.

Is this a deliberate change, or perhaps broken by some other coincidence? is it related to this change:
http://www.macromedia.com/support/coldfusion/releasenotes/mx/mx61_fixed_bugs.html
look for the number 49504 ?
No screen name said on Sep 19, 2005 at 11:32 AM :
you must have <cfsetting enablecfoutputonly="no"> OR must surround all contents by a cfoutput If using cfsavecontent to extend flash based cfforms, or any other usage of this tag where the actual text of the contents is needed (not neccesarily running cfcode within it).

again, seems redundant to some, but this problem bugged me for a few hours not realizing why my actionscript wasnt executing.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-a29.htm