GoDaddy and Flash Forms
Once upon a time, GoDaddy had an issue displaying Coldfusion-generated Flash Forms in Internet Explorer. I spent a few hours on the issue and found that it was related to a file that was unavailable, for whatever reason, to ColdFusion at runtime. I spent a lengthy amount of time working with GoDaddy's tech support personnel, who have since resolved the issue (good work!). However, I know that other companies that provide hosting may have similar problems, so the following is a workaround.
The Problem:
My Flash Forms work fine on my local machine/my dev box/my other production server, but when I upload an identical file to my new hosting server, my form does not appear and I get a JavaScript error.
The Solution:
First and foremost, you'll have to copy the CFIDE/scripts folder from your dev or local machine. The key is this: if it sits on the root of your site, you have to rename it something else. I renamed mine _CFIDE.
Then, you'll have to add some code above and below your form. Here is my sample code:
<cfsavecontent variable="_theForm">
<cfform name="theForm" format="Flash" width="300" height="200" accessible="yes">
<cfinput type="button" name="btn1" value="CLICK HERE" onClick="alert('The CFIDE hack works!')">
</cfform>
</cfsavecontent>
<cfoutput>#Replace(_theForm, "/CFIDE", "_CFIDE", "ALL")#</cfoutput>
<!--- Code snippet ends --->
Okay, so what does this all mean? It appears that the issue with some hosting facilities and FlashForms lies somewhere in the way that they handle the CFIDE directory. Among other things, CFIDE contains all of the JavaScript and such that is needed to successfully get a Flash Form up and running. A few times in development I have had problems because I forgot to create a virtual directory to point to CFIDE. So it makes sense that if I'm having problems with Flash Forms, it must mean that CFIDE is missing. So I can just upload my own CFIDE/scripts and I'll be on my way, right?
Wrong. CFIDE already exists within your hosting account, but it doesn't work for forms in IE. Why? It's missing a file called CF_RunActiveContent.js. Furthermore, simply uploading your own CFIDE/scripts will not work, because the servers will not recognize it. Basically their version of CFIDE takes precedence over yours. Bummer.
So what to do? Well you've likely already read the solution above, which involes copying CFIDE/scripts and then renaming it. In reality, all you need is CF_RunActiveContent.js, and by association, cfformhistory.cfm and cfformhistory.js. With a little tweaking, you could whittle it down to just CF_RunActiveContent.js, but it adds a few characters to the solution code. I digress.
So once you've put the files where the server can see them, all that is left to do is tweak the code that ColdFusion spits out. This is the reason for the cfsavecontent and the cfreplace. It basically allows you to tell ColdFusion that you want to change the output after it's processed. In the resulting HTML, anything that refers to CFIDE/scripts gets changed to your version, _CFIDE/scripts, including the reference to CF_RunActiveContent.js. Now able to see that file, IE puts on a big smile and renders your code, no questions asked. Voila.
So why all this trouble? What exactly is contained in this CF_RunActiveContent.js file that is so vital? (This is the part that will piss you off.) Here are the entire contents of CF_RunActiveContent.js:
//v1.0 Copyright 2006 Adobe Systems, Inc. All rights reserved. function CF_RunContent(src){document.write(src);}
All of this for a crappy little one-line function that does basically nothing?! That's why I've been struggling with Flash Forms all this time?!
Those of you at the head of the class are wondering at this point, why can't we just replace the function CF_RunContent with document.write inside the Replace tag? Wouldn't that save us the trouble of having to create our own version of the CFIDE directory? The short answer is, yes you can, but you won't want to.
Why not?
Because Microsoft lost a lawsuit and wants to punish the world for it. Google EOLA vs Microsoft for more on that.
Basically, if you take a shortcut and replace CF_RunContent with document.write, your form will display just fine, BUT... It will have that irritating little border around it that says you have to click or hit the spacebar to start using the flash object. I'm sure you've seen it, and it sucks. Fortunately, the folks at Macromedia kick @$$ and were able to circumvent it when using Flash Forms. The price? A tiny little one-line file, entitled... CF_RunActiveContent.js.
So that's the long (okay, very long) and the short of it. For now, you can get around the Flash Form bug with a fairly simple, albeit ugly, hack.
Thanks for your useful post.
I'm searching around this problem for 2 days, and this is the most useful article that I found.
my host is godaddy.
I copied the CFIDE folder and renamed it to _CFIDE as you menstion, but stil it doesn't work.
I try to run your code this is my source file in IE, the first 2 lines are still used "CFIDE" !!
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
<script type="text/javascript" charset='utf-8' src='_CFIDE/scripts/cfformhistory.js'></script>
<noscript>
<embed pluginspage='http://www.macromedia.com/go/getflashplayer' id='theForm' src='/visitsandiego/htdocs/1677870109.mxml.cfswf' width='300' height='200' wMode='Window' flashVars='%5F%5FtheForm%5Fcacheid=8B347353%2D219B%2DA616%2D649862B52E728C3C' ></embed>
</noscript>
<script type="text/javascript" charset='utf-8'>
document.write("<embed pluginspage='http://www.macromedia.com/go/getflashplayer' ");
document.write(" id='theForm' ");
document.write(" src='/visitsandiego/htdocs/1677870109.mxml.cfswf' ");
document.write(" width='300' ");
document.write(" height='200' ");
document.write(" wMode='Window' ");
document.write(" flashVars='historyUrl=%2FCFIDE%2Fscriptscfformhistory%2Ecfm%3F&lconid=" + lc_id +"&%5F%5FtheForm%5Fcacheid=8B347353%2D219B%2DA616%2D649862B52E728C3C' ></embed>");
</script>
<script type="text/javascript" charset='utf-8'>
document.write("<br><iframe src='_CFIDE/scripts/cfformhistory.cfm' name='_history' frameborder='0' scrolling='no' width='22' height='0'></iframe></br> ");
</script>
and one important thing is I don't have the file "1677870109.mxml.cfswf" in my code. Is it important?
Note: I just copied the CFIDE folder in the root of my host, it isn't virtual directory. and I copy your code in one file in the root.
I really appriciate if you could help me.
Thanks in advanced
Bahar
Sorry I never really got back to you on this. As you know by now, GoDaddy no longer supports Coldfusion hosting. I use that term loosely, since they didn't really support it very well in the first place. I've moved on to Hostek.com, and I have yet to test whether they have similar restrictions. Already, though, I can tell you that their support is excellent.
Good luck!
Josh