> If the file, employment-application.cfm, includes a <script> tag that
points to a CFM...

It doesn't.  Here are the files involved:

1) employment-application.cfm
2) application.cfc
2) employment-application-form-processing.js
3) employment-application.cfc

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
is successful.

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
employment-application.cfm.

Your suggestion to use

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

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">
</cfif>

and see if that works.

I'll give that a try.

Does any of this make sense?

Rick



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


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
one. If it requests something like javascript.cfm, then your
onRequestStart needs to recognize that too.

On Wed, May 23, 2012 at 6:46 AM, Rick Faircloth
<r...@whitestonemedia.com> wrote:
>
> 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 ] --->




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:351312
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to