This content has been marked as final. Show 3 replies
It has nothing in particular to do with cfdocument. It is that you practically disable a tag when you pass it as part of a string. Coldfusion ignores it. For example,
<cfset myVar = "<cfif 1 eq 1>True part<cfelse>False part</cfif>">
simply sends the text "<cfif 1 eq 1>True part<cfelse>False part</cfif>" to output. I usually left the story there.
However, Adam Cameron once made an important addition. Browsers are designed not to interprete or render tags they don't know. Since they don't know <cfif> or <cfelse>, they will ignore them. Hence, a browser will only display the text True partFalse part.
> However, Adam Cameron, once made an important addition.
Good god! I'm being cited.
The problem with the OP's code is that the <cfif> is being generated at
runtime, and any CFML code one expects to execute needs to be there at
COMPILE time. CFML is not executed at runtime, so one cannot generate CFML
at runtime and hope for it to execute. That's not how it works. And even
if it was, one cannot expect it to be interpretted simply by *outputing*
it. As BKBK said: all you're doing is sending a string to the browser (or,
in this case, the PDF generator) which happens to have some CFML in it.
You need to revise your logic / approach.
Thanks guys. Back to square one, with rather improved understanding, and a lesson learned for next time!