> <cfif listLast(thepage, '/') is not "employment-application.cfc">
> and see if that works.
That seems to have worked, on the initial test. The JSON response
doesn't include the js script tags and content as it did when I
used "employment-application.cfm", instead of the .cfc above.
I hadn't thought that the "employment-application.cfc" file would be
considered the requesting file by the onRequestMethod
when the method in employment-application.cfc involved ran. That being
the case, I can understand how the js script gets included in the JSON,
because the onRequestStart "cfoutput's" the js script in order
to assign value to the CF variables using ##'s inside the js script.
var js_client_dsn = '#client_dsn#';
I don't *think* that I can assign the value to the var without
using cfoutput and the ##'s around the CF variables.
The only thing I know at this point for sure is that I have a working
solution to the form processing for an impatient client.
So, this hack will have to stand for now.
Now to see if this works on the production site. :o)
From: Rick Faircloth [mailto:Rick@Whit...]
Sent: Wednesday, May 23, 2012 8:55 AM
Subject: RE: How to prevent cfhtmlhead content from being inserted into
> If the file, employment-application.cfm, includes a <script> tag that
points to a CFM...
employment-application.cfm has the above js file
included via a script link.
The js file has an AJAX call to a method in
employment-application.cfc for processing the form
contained in the .cfm above.
employment-application.cfc, as well as processing the
form, also sends a couple of cfmail messages, if processing
After successful processing of the form and sending of the
cfmail messages in the cfc method, JSON is sent back to the
AJAX call in the js file, which then, as the final step,
should change the "processing" message the user sees on the
form to a "success" message.
But because the JSON includes more than just the message
"FORMSTATUS:SUCCESS" in its content, which is the js script
from the onRequestStart method in the application.cfc, the
js won't complete the last step.
I'm just trying to find a way to prevent the js script
that gets inserted into the head of each page from being
included in the JSON data returned.
I don't need the js variables that are included via the
onRequestStart for the employment-application.cfm page, so
I was trying to find a way to prevent application.cfc from
processing the js variables if the requesting page is
Your suggestion to use
<cfif listLast(thepage, '/') is not "employment-application.cfm">
worked fine, to bypass the CF code processing the application.cfc,
but the js script contained inside the conditional statement
still shows up in the JSON.
Either the conditional statement above won't afffect the inclusion
<script></script> tag contained in the onRequestStart method or
the AJAX call from the js file to the employment-application.cfc
method also triggers the onRequestStart method and that causes the
JSON to include the js script code.
Perhaps I should try
<cfif listLast(thepage, '/') is not "employment-application.cfc">
and see if that works.
I'll give that a try.
Does any of this make sense?
From: Raymond Camden [mailto:raymondcamden@gmai...]
Sent: Wednesday, May 23, 2012 7:52 AM
Subject: Re: How to prevent cfhtmlhead content from being inserted into
You are confusing requests here.
If the file, employment-application.cfm, includes a <script> tag that
points to a CFM, that's a _second_ request, not the same as the first
onRequestStart needs to recognize that too.
On Wed, May 23, 2012 at 6:46 AM, Rick Faircloth
> 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 ] --->