Re: Question about using javascript in .cfm files...

2010-10-28 Thread Carl Von Stetten

Rick,

I have shared CF variables with JavaScript too.  What I usually do is this:

If I have to do any processes to define the CF variables, I put them at 
the top of the document, above the head section.  Then, in the head 
section of my CFM page, I add a cfoutput inside a script tag and 
pass all of the desired CF variables into JavaScript variables.  I make 
sure this is defined before I load any external JavaScript files and 
call any JavaScript functions.

This way my JavaScript files retain their .js extension.

HTH,
Carl

On 10/27/2010 10:44 AM, Rick Faircloth wrote:
 I've been using js files as .cfm files
 so I can intermix cf variables in the js.

 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.

 Here's the question:

 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?

 e.g., should the function checkUserFavorites:

 function checkUserFavorites(USERID) {

   blah, blah, blah

 be defined if the js were in a .cfm file as readily
 as it would in a .js file?

 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.

 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.

 Thanks for any feedback.

 Rick





 

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


Re: Question about using javascript in .cfm files...

2010-10-28 Thread Carl Von Stetten

Rick,

I have shared CF variables with JavaScript too.  What I usually do is this:

If I have to do any processes to define the CF variables, I put them at the top 
of the document, above the head section.  Then, in the head section of my 
CFM page, I add a cfoutput inside a script tag and pass all of the desired 
CF variables into JavaScript variables.  I make sure this is defined before I 
load any external JavaScript files and call any JavaScript functions.

This way my JavaScript files retain their .js extension.

HTH,
Carl 

I've been using js files as .cfm files
so I can intermix cf variables in the js.

i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

This seems to work fine, but I've run into an issue
that makes me wonder if this works in all cases as
a regular js file would.

Here's the question:

If I have a js function in a .cfm file, would the
declared function be defined by the browser
upon first entering a page as it would if the function
were in a .js file?

e.g., should the function checkUserFavorites:

function checkUserFavorites(USERID) {

   blah, blah, blah

be defined if the js were in a .cfm file as readily
as it would in a .js file?

I keep running into a checkUserFavorites is not defined
for which I cannot track down the problem.

I'm reaching for an answer at this point, because I can't
otherwise explain the error message otherwise, yet.

Thanks for any feedback.

Rick 

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


RE: Question about using javascript in .cfm files...

2010-10-28 Thread Rick Faircloth

Interesting approach, Carl!
Haven't thought about that.
I'll definitely give that a try!

Thanks for the tip!

Rick

-Original Message-
From: Carl Von Stetten [mailto:cmvon...@hotmail.com] 
Sent: Thursday, October 28, 2010 11:19 AM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


Rick,

I have shared CF variables with JavaScript too.  What I usually do is this:

If I have to do any processes to define the CF variables, I put them at the
top of the document, above the head section.  Then, in the head section
of my CFM page, I add a cfoutput inside a script tag and pass all of the
desired CF variables into JavaScript variables.  I make sure this is defined
before I load any external JavaScript files and call any JavaScript
functions.

This way my JavaScript files retain their .js extension.

HTH,
Carl 

I've been using js files as .cfm files
so I can intermix cf variables in the js.

i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

This seems to work fine, but I've run into an issue
that makes me wonder if this works in all cases as
a regular js file would.

Here's the question:

If I have a js function in a .cfm file, would the
declared function be defined by the browser
upon first entering a page as it would if the function
were in a .js file?

e.g., should the function checkUserFavorites:

function checkUserFavorites(USERID) {

   blah, blah, blah

be defined if the js were in a .cfm file as readily
as it would in a .js file?

I keep running into a checkUserFavorites is not defined
for which I cannot track down the problem.

I'm reaching for an answer at this point, because I can't
otherwise explain the error message otherwise, yet.

Thanks for any feedback.

Rick 



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


Re: Question about using javascript in .cfm files...

2010-10-28 Thread Michael Grant

I'll +1 that. I generally only use CF to set js vars at the top of the head
too. That way your js can stay pure js.


On Thu, Oct 28, 2010 at 12:04 PM, Rick Faircloth ric...@whitestonemedia.com
 wrote:


 Interesting approach, Carl!
 Haven't thought about that.
 I'll definitely give that a try!

 Thanks for the tip!

 Rick

 -Original Message-
 From: Carl Von Stetten [mailto:cmvon...@hotmail.com]
 Sent: Thursday, October 28, 2010 11:19 AM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 Rick,

 I have shared CF variables with JavaScript too.  What I usually do is this:

 If I have to do any processes to define the CF variables, I put them at the
 top of the document, above the head section.  Then, in the head section
 of my CFM page, I add a cfoutput inside a script tag and pass all of
 the
 desired CF variables into JavaScript variables.  I make sure this is
 defined
 before I load any external JavaScript files and call any JavaScript
 functions.

 This way my JavaScript files retain their .js extension.

 HTH,
 Carl

 I've been using js files as .cfm files
 so I can intermix cf variables in the js.
 
 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.
 
 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.
 
 Here's the question:
 
 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?
 
 e.g., should the function checkUserFavorites:
 
 function checkUserFavorites(USERID) {
 
blah, blah, blah
 
 be defined if the js were in a .cfm file as readily
 as it would in a .js file?
 
 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.
 
 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.
 
 Thanks for any feedback.
 
 Rick



 

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


Re: Question about using javascript in .cfm files...

2010-10-28 Thread Dave Merrill

+1

On Thu, Oct 28, 2010 at 2:06 PM, Michael Grant mgr...@modus.bz wrote:

 I'll +1 that. I generally only use CF to set js vars at the top of the head
 too. That way your js can stay pure js.


 On Thu, Oct 28, 2010 at 12:04 PM, Rick Faircloth ric...@whitestonemedia.com
 wrote:


 Interesting approach, Carl!
 Haven't thought about that.
 I'll definitely give that a try!

 Thanks for the tip!

 Rick

 -Original Message-
 From: Carl Von Stetten [mailto:cmvon...@hotmail.com]
 Sent: Thursday, October 28, 2010 11:19 AM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 Rick,

 I have shared CF variables with JavaScript too.  What I usually do is this:

 If I have to do any processes to define the CF variables, I put them at the
 top of the document, above the head section.  Then, in the head section
 of my CFM page, I add a cfoutput inside a script tag and pass all of
 the
 desired CF variables into JavaScript variables.  I make sure this is
 defined
 before I load any external JavaScript files and call any JavaScript
 functions.

 This way my JavaScript files retain their .js extension.

 HTH,
 Carl

 I've been using js files as .cfm files
 so I can intermix cf variables in the js.
 
 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.
 
 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.
 
 Here's the question:
 
 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?
 
 e.g., should the function checkUserFavorites:
 
 function checkUserFavorites(USERID) {
 
        blah, blah, blah
 
 be defined if the js were in a .cfm file as readily
 as it would in a .js file?
 
 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.
 
 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.
 
 Thanks for any feedback.
 
 Rick





 

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


RE: Question about using javascript in .cfm files...

2010-10-28 Thread Rick Faircloth

Yes, I definitely like the idea.
I didn't like having to mix cf with the js.

So, is this as simple as:

cfset jsVar = myCFVar

and then using jsVar in the js?

I haven't tried any of this or even searched
for an answerjust being lazy.

Example?

Rick

-Original Message-
From: Michael Grant [mailto:mgr...@modus.bz] 
Sent: Thursday, October 28, 2010 2:06 PM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


I'll +1 that. I generally only use CF to set js vars at the top of the head
too. That way your js can stay pure js.


On Thu, Oct 28, 2010 at 12:04 PM, Rick Faircloth ric...@whitestonemedia.com
 wrote:


 Interesting approach, Carl!
 Haven't thought about that.
 I'll definitely give that a try!

 Thanks for the tip!

 Rick

 -Original Message-
 From: Carl Von Stetten [mailto:cmvon...@hotmail.com]
 Sent: Thursday, October 28, 2010 11:19 AM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 Rick,

 I have shared CF variables with JavaScript too.  What I usually do is
this:

 If I have to do any processes to define the CF variables, I put them at
the
 top of the document, above the head section.  Then, in the head
section
 of my CFM page, I add a cfoutput inside a script tag and pass all of
 the
 desired CF variables into JavaScript variables.  I make sure this is
 defined
 before I load any external JavaScript files and call any JavaScript
 functions.

 This way my JavaScript files retain their .js extension.

 HTH,
 Carl

 I've been using js files as .cfm files
 so I can intermix cf variables in the js.
 
 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.
 
 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.
 
 Here's the question:
 
 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?
 
 e.g., should the function checkUserFavorites:
 
 function checkUserFavorites(USERID) {
 
blah, blah, blah
 
 be defined if the js were in a .cfm file as readily
 as it would in a .js file?
 
 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.
 
 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.
 
 Thanks for any feedback.
 
 Rick



 



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


Re: Question about using javascript in .cfm files...

2010-10-28 Thread Michael Grant

No, more like this

cfset jsVar = myCFVar /

cfoutput
script

var jsVar = '#jsVar#';

/script
/cfoutput

script src=srcJS.js/script

On Thu, Oct 28, 2010 at 2:19 PM, Rick Faircloth
ric...@whitestonemedia.comwrote:


 Yes, I definitely like the idea.
 I didn't like having to mix cf with the js.

 So, is this as simple as:

 cfset jsVar = myCFVar

 and then using jsVar in the js?

 I haven't tried any of this or even searched
 for an answerjust being lazy.

 Example?

 Rick

 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Thursday, October 28, 2010 2:06 PM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 I'll +1 that. I generally only use CF to set js vars at the top of the head
 too. That way your js can stay pure js.


 On Thu, Oct 28, 2010 at 12:04 PM, Rick Faircloth 
 ric...@whitestonemedia.com
  wrote:

 
  Interesting approach, Carl!
  Haven't thought about that.
  I'll definitely give that a try!
 
  Thanks for the tip!
 
  Rick
 
  -Original Message-
  From: Carl Von Stetten [mailto:cmvon...@hotmail.com]
  Sent: Thursday, October 28, 2010 11:19 AM
  To: cf-talk
  Subject: Re: Question about using javascript in .cfm files...
 
 
  Rick,
 
  I have shared CF variables with JavaScript too.  What I usually do is
 this:
 
  If I have to do any processes to define the CF variables, I put them at
 the
  top of the document, above the head section.  Then, in the head
 section
  of my CFM page, I add a cfoutput inside a script tag and pass all of
  the
  desired CF variables into JavaScript variables.  I make sure this is
  defined
  before I load any external JavaScript files and call any JavaScript
  functions.
 
  This way my JavaScript files retain their .js extension.
 
  HTH,
  Carl
 
  I've been using js files as .cfm files
  so I can intermix cf variables in the js.
  
  i.e., naming myJSFile.js, myJSFile.js.cfm, instead.
  
  This seems to work fine, but I've run into an issue
  that makes me wonder if this works in all cases as
  a regular js file would.
  
  Here's the question:
  
  If I have a js function in a .cfm file, would the
  declared function be defined by the browser
  upon first entering a page as it would if the function
  were in a .js file?
  
  e.g., should the function checkUserFavorites:
  
  function checkUserFavorites(USERID) {
  
 blah, blah, blah
  
  be defined if the js were in a .cfm file as readily
  as it would in a .js file?
  
  I keep running into a checkUserFavorites is not defined
  for which I cannot track down the problem.
  
  I'm reaching for an answer at this point, because I can't
  otherwise explain the error message otherwise, yet.
  
  Thanks for any feedback.
  
  Rick
 
 
 
 



 

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


RE: Question about using javascript in .cfm files...

2010-10-28 Thread Rick Faircloth

Alright, good deal.

I'll put that to use right away and strip out my
CF from the JS from now on.

Thanks for the tip, everyone!

Rick

-Original Message-
From: Michael Grant [mailto:mgr...@modus.bz] 
Sent: Thursday, October 28, 2010 2:30 PM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


No, more like this

cfset jsVar = myCFVar /

cfoutput
script

var jsVar = '#jsVar#';

/script
/cfoutput

script src=srcJS.js/script

On Thu, Oct 28, 2010 at 2:19 PM, Rick Faircloth
ric...@whitestonemedia.comwrote:


 Yes, I definitely like the idea.
 I didn't like having to mix cf with the js.

 So, is this as simple as:

 cfset jsVar = myCFVar

 and then using jsVar in the js?

 I haven't tried any of this or even searched
 for an answerjust being lazy.

 Example?

 Rick

 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Thursday, October 28, 2010 2:06 PM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 I'll +1 that. I generally only use CF to set js vars at the top of the
head
 too. That way your js can stay pure js.


 On Thu, Oct 28, 2010 at 12:04 PM, Rick Faircloth 
 ric...@whitestonemedia.com
  wrote:

 
  Interesting approach, Carl!
  Haven't thought about that.
  I'll definitely give that a try!
 
  Thanks for the tip!
 
  Rick
 
  -Original Message-
  From: Carl Von Stetten [mailto:cmvon...@hotmail.com]
  Sent: Thursday, October 28, 2010 11:19 AM
  To: cf-talk
  Subject: Re: Question about using javascript in .cfm files...
 
 
  Rick,
 
  I have shared CF variables with JavaScript too.  What I usually do is
 this:
 
  If I have to do any processes to define the CF variables, I put them at
 the
  top of the document, above the head section.  Then, in the head
 section
  of my CFM page, I add a cfoutput inside a script tag and pass all of
  the
  desired CF variables into JavaScript variables.  I make sure this is
  defined
  before I load any external JavaScript files and call any JavaScript
  functions.
 
  This way my JavaScript files retain their .js extension.
 
  HTH,
  Carl
 
  I've been using js files as .cfm files
  so I can intermix cf variables in the js.
  
  i.e., naming myJSFile.js, myJSFile.js.cfm, instead.
  
  This seems to work fine, but I've run into an issue
  that makes me wonder if this works in all cases as
  a regular js file would.
  
  Here's the question:
  
  If I have a js function in a .cfm file, would the
  declared function be defined by the browser
  upon first entering a page as it would if the function
  were in a .js file?
  
  e.g., should the function checkUserFavorites:
  
  function checkUserFavorites(USERID) {
  
 blah, blah, blah
  
  be defined if the js were in a .cfm file as readily
  as it would in a .js file?
  
  I keep running into a checkUserFavorites is not defined
  for which I cannot track down the problem.
  
  I'm reaching for an answer at this point, because I can't
  otherwise explain the error message otherwise, yet.
  
  Thanks for any feedback.
  
  Rick
 
 
 
 



 



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


RE: Question about using javascript in .cfm files...

2010-10-28 Thread Rick Faircloth

Question:

What about using onApplicationStart in application.cfc to set
global cf to js variables for the site

and

using onRequestStart in application.cfc to set specific page
cf to js variables for a page.

Gives me only one place to change variables.

Any drawbacks to that approach?



-Original Message-
From: Michael Grant [mailto:mgr...@modus.bz] 
Sent: Thursday, October 28, 2010 2:30 PM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


No, more like this

cfset jsVar = myCFVar /

cfoutput
script

var jsVar = '#jsVar#';

/script
/cfoutput

script src=srcJS.js/script





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


Re: Question about using javascript in .cfm files...

2010-10-28 Thread Michael Grant

Well the thing is that the js variables need to be part of the DOM. You can
your cf vars in both of those functions and then just reference them in your
display templates when you set up the js vars. That would also give you a
chance to override them on a per page basis.

On Thu, Oct 28, 2010 at 3:39 PM, Rick Faircloth r...@whitestonemedia.comwrote:


 Question:

 What about using onApplicationStart in application.cfc to set
 global cf to js variables for the site

 and

 using onRequestStart in application.cfc to set specific page
 cf to js variables for a page.

 Gives me only one place to change variables.

 Any drawbacks to that approach?



 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Thursday, October 28, 2010 2:30 PM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 No, more like this

 cfset jsVar = myCFVar /

 cfoutput
 script

 var jsVar = '#jsVar#';

 /script
 /cfoutput

 script src=srcJS.js/script





 

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


RE: Question about using javascript in .cfm files...

2010-10-28 Thread Rick Faircloth

Alright, thanks!


-Original Message-
From: Michael Grant [mailto:mgr...@modus.bz] 
Sent: Thursday, October 28, 2010 3:47 PM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


Well the thing is that the js variables need to be part of the DOM. You can
your cf vars in both of those functions and then just reference them in your
display templates when you set up the js vars. That would also give you a
chance to override them on a per page basis.

On Thu, Oct 28, 2010 at 3:39 PM, Rick Faircloth
r...@whitestonemedia.comwrote:


 Question:

 What about using onApplicationStart in application.cfc to set
 global cf to js variables for the site

 and

 using onRequestStart in application.cfc to set specific page
 cf to js variables for a page.

 Gives me only one place to change variables.

 Any drawbacks to that approach?



 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Thursday, October 28, 2010 2:30 PM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 No, more like this

 cfset jsVar = myCFVar /

 cfoutput
 script

 var jsVar = '#jsVar#';

 /script
 /cfoutput

 script src=srcJS.js/script





 



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


Question about using javascript in .cfm files...

2010-10-27 Thread Rick Faircloth

I've been using js files as .cfm files
so I can intermix cf variables in the js.

i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

This seems to work fine, but I've run into an issue
that makes me wonder if this works in all cases as
a regular js file would.

Here's the question:

If I have a js function in a .cfm file, would the
declared function be defined by the browser
upon first entering a page as it would if the function
were in a .js file?

e.g., should the function checkUserFavorites:

function checkUserFavorites(USERID) {

blah, blah, blah

be defined if the js were in a .cfm file as readily
as it would in a .js file?

I keep running into a checkUserFavorites is not defined
for which I cannot track down the problem.

I'm reaching for an answer at this point, because I can't
otherwise explain the error message otherwise, yet.

Thanks for any feedback.

Rick

 



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


Re: Question about using javascript in .cfm files...

2010-10-27 Thread denstar

It's pretty much exactly the same.  Even more exacter if you set the
content type to text/javascript or whatever using cfcontent.

:Den

-- 
Custom is our nature. What are our natural principles but principles of custom?
Blaise Pascal

On Wed, Oct 27, 2010 at 11:44 AM, Rick Faircloth wrote:

 I've been using js files as .cfm files
 so I can intermix cf variables in the js.

 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.

 Here's the question:

 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?

 e.g., should the function checkUserFavorites:

 function checkUserFavorites(USERID) {

        blah, blah, blah

 be defined if the js were in a .cfm file as readily
 as it would in a .js file?

 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.

 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.

 Thanks for any feedback.

 Rick





 

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


Re: Question about using javascript in .cfm files...

2010-10-27 Thread Michael Grant

Yeah, to the browser they are identical. Is it possible that you are calling
your function before it's been added to the document? Like you don't
call checkUserFavorites above your script tag do you? What does firebug or
chrome tools show you as the content of the file? If your page is being
rendered while suppress whitespace (cfsilent, enablecfoutputonly, etc) you
may need to wrap your js producing code in cfoutput.



On Wed, Oct 27, 2010 at 1:44 PM, Rick Faircloth r...@whitestonemedia.comwrote:


 I've been using js files as .cfm files
 so I can intermix cf variables in the js.

 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.

 Here's the question:

 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?

 e.g., should the function checkUserFavorites:

 function checkUserFavorites(USERID) {

blah, blah, blah

 be defined if the js were in a .cfm file as readily
 as it would in a .js file?

 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.

 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.

 Thanks for any feedback.

 Rick





 

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


RE: Question about using javascript in .cfm files...

2010-10-27 Thread Rick Faircloth

Thanks for the tip on the content type.
I've been living with syntax highlighting since
js highlighting was applied because of the .cfm extension
and cf doesn't highlight the js. :oP

Perhaps now I can have my cake and eat it, too! :o)


-Original Message-
From: denstar [mailto:valliants...@gmail.com] 
Sent: Wednesday, October 27, 2010 7:33 PM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


It's pretty much exactly the same.  Even more exacter if you set the
content type to text/javascript or whatever using cfcontent.

:Den

-- 
Custom is our nature. What are our natural principles but principles of
custom?
Blaise Pascal

On Wed, Oct 27, 2010 at 11:44 AM, Rick Faircloth wrote:

 I've been using js files as .cfm files
 so I can intermix cf variables in the js.

 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.

 Here's the question:

 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?

 e.g., should the function checkUserFavorites:

 function checkUserFavorites(USERID) {

        blah, blah, blah

 be defined if the js were in a .cfm file as readily
 as it would in a .js file?

 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.

 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.

 Thanks for any feedback.

 Rick





 



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


RE: Question about using javascript in .cfm files...

2010-10-27 Thread Rick Faircloth

I had the same idea of the function being called before the DOM
was loaded, so I tried moving the js to the head as opposed to the
end of the body to see if that mattered...didn't help.

I think something is going on with Firefox when trying to get it
to include some of the js files.  First, updates weren't appearing
quickly when edited files were FTP'd to the server and then I noticed
that some of the files weren't even listed in Firefox when I attempted
to make sure they were being read when viewing the Script tab.

I had to restart Firefox and sometimes make minor changes like adding
a space to get a file to be read by the browser.

I guarantee you it's not the first time I've had quirkiness when working
with a lot of js, ajax, and cf together.

Thanks for the feedback!

Rick

-Original Message-
From: Michael Grant [mailto:mgr...@modus.bz] 
Sent: Wednesday, October 27, 2010 7:52 PM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


Yeah, to the browser they are identical. Is it possible that you are calling
your function before it's been added to the document? Like you don't
call checkUserFavorites above your script tag do you? What does firebug or
chrome tools show you as the content of the file? If your page is being
rendered while suppress whitespace (cfsilent, enablecfoutputonly, etc) you
may need to wrap your js producing code in cfoutput.



On Wed, Oct 27, 2010 at 1:44 PM, Rick Faircloth
r...@whitestonemedia.comwrote:


 I've been using js files as .cfm files
 so I can intermix cf variables in the js.

 i.e., naming myJSFile.js, myJSFile.js.cfm, instead.

 This seems to work fine, but I've run into an issue
 that makes me wonder if this works in all cases as
 a regular js file would.

 Here's the question:

 If I have a js function in a .cfm file, would the
 declared function be defined by the browser
 upon first entering a page as it would if the function
 were in a .js file?

 e.g., should the function checkUserFavorites:

 function checkUserFavorites(USERID) {

blah, blah, blah

 be defined if the js were in a .cfm file as readily
 as it would in a .js file?

 I keep running into a checkUserFavorites is not defined
 for which I cannot track down the problem.

 I'm reaching for an answer at this point, because I can't
 otherwise explain the error message otherwise, yet.

 Thanks for any feedback.

 Rick





 



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


Re: Question about using javascript in .cfm files...

2010-10-27 Thread Michael Grant

I think CTRL+SHIFT+R forces a full refresh in FF.

On Wed, Oct 27, 2010 at 9:05 PM, Rick Faircloth r...@whitestonemedia.comwrote:


 I had the same idea of the function being called before the DOM
 was loaded, so I tried moving the js to the head as opposed to the
 end of the body to see if that mattered...didn't help.

 I think something is going on with Firefox when trying to get it
 to include some of the js files.  First, updates weren't appearing
 quickly when edited files were FTP'd to the server and then I noticed
 that some of the files weren't even listed in Firefox when I attempted
 to make sure they were being read when viewing the Script tab.

 I had to restart Firefox and sometimes make minor changes like adding
 a space to get a file to be read by the browser.

 I guarantee you it's not the first time I've had quirkiness when working
 with a lot of js, ajax, and cf together.

 Thanks for the feedback!

 Rick

 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Wednesday, October 27, 2010 7:52 PM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 Yeah, to the browser they are identical. Is it possible that you are
 calling
 your function before it's been added to the document? Like you don't
 call checkUserFavorites above your script tag do you? What does firebug
 or
 chrome tools show you as the content of the file? If your page is being
 rendered while suppress whitespace (cfsilent, enablecfoutputonly, etc) you
 may need to wrap your js producing code in cfoutput.



 On Wed, Oct 27, 2010 at 1:44 PM, Rick Faircloth
 r...@whitestonemedia.comwrote:

 
  I've been using js files as .cfm files
  so I can intermix cf variables in the js.
 
  i.e., naming myJSFile.js, myJSFile.js.cfm, instead.
 
  This seems to work fine, but I've run into an issue
  that makes me wonder if this works in all cases as
  a regular js file would.
 
  Here's the question:
 
  If I have a js function in a .cfm file, would the
  declared function be defined by the browser
  upon first entering a page as it would if the function
  were in a .js file?
 
  e.g., should the function checkUserFavorites:
 
  function checkUserFavorites(USERID) {
 
 blah, blah, blah
 
  be defined if the js were in a .cfm file as readily
  as it would in a .js file?
 
  I keep running into a checkUserFavorites is not defined
  for which I cannot track down the problem.
 
  I'm reaching for an answer at this point, because I can't
  otherwise explain the error message otherwise, yet.
 
  Thanks for any feedback.
 
  Rick
 
 
 
 
 
 



 

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


RE: Question about using javascript in .cfm files...

2010-10-27 Thread Rick Faircloth

Thanks for the tip.


-Original Message-
From: Michael Grant [mailto:mgr...@modus.bz] 
Sent: Wednesday, October 27, 2010 9:10 PM
To: cf-talk
Subject: Re: Question about using javascript in .cfm files...


I think CTRL+SHIFT+R forces a full refresh in FF.

On Wed, Oct 27, 2010 at 9:05 PM, Rick Faircloth
r...@whitestonemedia.comwrote:


 I had the same idea of the function being called before the DOM
 was loaded, so I tried moving the js to the head as opposed to the
 end of the body to see if that mattered...didn't help.

 I think something is going on with Firefox when trying to get it
 to include some of the js files.  First, updates weren't appearing
 quickly when edited files were FTP'd to the server and then I noticed
 that some of the files weren't even listed in Firefox when I attempted
 to make sure they were being read when viewing the Script tab.

 I had to restart Firefox and sometimes make minor changes like adding
 a space to get a file to be read by the browser.

 I guarantee you it's not the first time I've had quirkiness when working
 with a lot of js, ajax, and cf together.

 Thanks for the feedback!

 Rick

 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Wednesday, October 27, 2010 7:52 PM
 To: cf-talk
 Subject: Re: Question about using javascript in .cfm files...


 Yeah, to the browser they are identical. Is it possible that you are
 calling
 your function before it's been added to the document? Like you don't
 call checkUserFavorites above your script tag do you? What does firebug
 or
 chrome tools show you as the content of the file? If your page is being
 rendered while suppress whitespace (cfsilent, enablecfoutputonly, etc) you
 may need to wrap your js producing code in cfoutput.



 On Wed, Oct 27, 2010 at 1:44 PM, Rick Faircloth
 r...@whitestonemedia.comwrote:

 
  I've been using js files as .cfm files
  so I can intermix cf variables in the js.
 
  i.e., naming myJSFile.js, myJSFile.js.cfm, instead.
 
  This seems to work fine, but I've run into an issue
  that makes me wonder if this works in all cases as
  a regular js file would.
 
  Here's the question:
 
  If I have a js function in a .cfm file, would the
  declared function be defined by the browser
  upon first entering a page as it would if the function
  were in a .js file?
 
  e.g., should the function checkUserFavorites:
 
  function checkUserFavorites(USERID) {
 
 blah, blah, blah
 
  be defined if the js were in a .cfm file as readily
  as it would in a .js file?
 
  I keep running into a checkUserFavorites is not defined
  for which I cannot track down the problem.
 
  I'm reaching for an answer at this point, because I can't
  otherwise explain the error message otherwise, yet.
 
  Thanks for any feedback.
 
  Rick
 
 
 
 
 
 



 



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