<charlie griefer>

*tap*tap*tap* is this thing on?

cfwindow and javascript gotcha

august 5, 2008 at 5:34pm in ColdFusion

ok i'll be honest, this is straight out of the docs, but i figure there may be one or two people out there that don't read the docs, so it might be worth passing along.

today i needed to create a <cfwindow> (a tag that i do like, in spite of being on the fence as to whether or not i think the AJAX bits really belong in CF... but that's another post). the source was a page that already existed in another part of the site i was working on. this page made some pretty heavy use of javascript, and not surprisingly, my first efforts to display it resulted in dismal failure.

the error occurred on the following 3 lines of js:

  1. function Output() { }
  2. function Proxy() { }
  3. function Handler() { }

a quick check of the aforementioned docs turned up the following:

If the source attribute specifies a page that defines JavaScript functions, the function definitions on that page must have the following format:

functionName = function(arguments) {function body}

Function definitions that use the following format may not work:

function functionName (arguments) {function body}

so the fix was thankfully much simpler than i had expected it would be. the 3 lines of js above simply needed to be changed to:

  1. Output = function() { }
  2. Proxy = function() { }
  3. Handler = function() { }

...and everything was up and running and worked a treat. hope that might save somebody a few extra minutes of debugging. of course, if you want to walk away with a moral to the story... read the docs. be the docs. love the docs.:)

comments (Comment Moderation is enabled. Your comment will not appear until approved.)add comment
todd sharp's Gravatar
todd sharp
# Aug 5, 2008 @ 7:30 PM
 
RTFM FTW


 
© 1904-2008, charlie griefer - design based on *Limelight* by www.mitchinson.net
blogCFC was created by raymond camden. this blog is running version 5.9.002.

CSS | XHTML