opensubscriber
   Find in this group all groups
 
Unknown more information…

c : cf-talk@houseoffusion.com 23 May 2012 • 7:46PM -0400

RE: How to prevent cfhtmlhead content from being inserted into cfmail...
by Rick Faircloth

REPLY TO AUTHOR
 
REPLY TO GROUP





The JS and CF affected by the commenting is in the onRequestStart
function in the application.cfc:

<cfsavecontent variable = "jsVariables">

   <!--- [ js version of cf variables ] --->

   <cfset  js_sitename             =     application.sitename          />
   <cfset  js_website              =     application.website           />
   <cfset  js_site_manager_dsn     =     application.site_manager_dsn  />
   <cfset  js_client_dsn           =     application.client_dsn        />

   <cfoutput>

      <script type="text/javascript">

         var  js_sitename          =    '#js_sitename#';
         var  js_website           =    '#js_website#';
         var  js_site_manager_dsn  =    '#js_site_manager_dsn#';
         var  js_client_dsn        =    '#js_client_dsn#';

      </script>

   </cfoutput>

</cfsavecontent>

<cfhtmlhead text = "#jsVariables#" />


If I use:

<cfif listLast(arguments.thepage, '/') is not "employment-application.cfm">

</cfif>

around the code above, it prevents the insertion of code into the head of
employment-application.cfm, but the lines between and including,
"<script type="text/javascript">...</script>" still get inserted into the
JSON produced by an AJAX call from employment-application.cfm.



-----Original Message-----
From: Raymond Camden [mailto:raymondcamden@gmai...]
Sent: Wednesday, May 23, 2012 7:25 AM
To: cf-talk
Subject: Re: How to prevent cfhtmlhead content from being inserted into
cfmail...


On Tue, May 22, 2012 at 10:50 PM, Rick Faircloth
<Rick@whit...> wrote:
> Well, apparently, I can conditionally comment out any of the
> CF based on the requesting file. However, the JS isn't affected
> by the conditional comments and still shows up in the JSON, causing
> the JS to stop processing.  Once I remove the JS, the processing
> occurs normally.

Is your JS in a CFM file? If so, it doesn't matter. CF doesn't care if
you output HTML, JS, or Klingon. If it is a CFM or a CFC _file_, then
onRequestStart will fire.

> PS - I appreciate the tip on "thepage" variable passed onRequestStart.
> I didn't find that in the docs, specifically, nor in other Google
searches.

It is there - in the CFML Reference, chapter 8 (well, for CF10) is:
Application CFC Reference



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351310
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.