cfform JavaScript error “‘lc_id’ is undefined”
Friday, April 8th, 2005I had downloaded a copy of ColdFusion MX 7, excited to get started on building the Web site you are reading at this very moment. It is likely that anyone who has downloaded the free trial from Macromedia’s Web site did so to see what all the rage was about the new features of the cfform tag. I admit I fell into that camp.
The error
Everything was working fine on my trial copy, and I loved the functionality of format="flash", so I decided to sign up for ColdFusion MX 7 hosting. Lo and behold, when the form was loaded from my new hosting server, Internet Explorer 6 started thowing a JavaScript error because of the form. It also stopped rendering the rest of the page. The JavaScript error looked like this:

What’s worse is that Firefox was more lenient and didn’t show any sign of error. I’d have to say that was a first for Firefox to be more lenient than MSIE.
Also, neither browser would submit the form data to the action page because of the error, so I had all kinds of fun ColdFusion errors on the action page after clicking the submit button.
A word of advice on searching
When such an error comes up, always search for the error message in your search engine. Google will turn up much better results if you search for “lc_id is undefined coldfusion cfform” rather than “coldfusion 7 cfform javascript error.” Give it a try if you don’t believe me.
The solution
When the hosting company created my account, they did not copy the /CFIDE/scripts directory into my Web root. The Flash-based cfform relies on the files in this directory. This folder was more than likely omitted for security reasons, but they cut off one of the key features of CFMX 7 by doing so.
To fix the issue, I FTPed the /CFIDE/scripts folder from my local CFMX 7 install to my remote host in binary mode. Keep in mind that Dreamweaver has issues FTPing binary files (it defaults to ASCII mode for binary files other than images and SWFs), so it’s best to send any files in /CFIDE from a FTP application other than Dreamweaver in binary mode.
You can enjoy the fruits of my labor by leaving a comment on my Flash-based cfform! (Note: now that I’m on WordPress, which is PHP, there is no Flash-based cfform anymore.)



June 19th, 2005 at 6:16 am
This ‘tip’ worked fine for me, thanks!
August 11th, 2005 at 2:39 pm
fgj
August 12th, 2005 at 8:27 am
I take it that “fgj” means, “I was simply trying out the Flash forms in ColdFusion MX 7.” I don’t know though; I’m not so good with chat acronyms and abbreviations.
September 29th, 2005 at 12:08 pm
Very detailed post, addressed the problem, thank you much.
September 30th, 2005 at 5:51 pm
Hi PeterI have just started developing a personal blog site and planned to use cfform. I encountered the sames issues as yourself when I uploaded my site to my host.I have since forwarded them your article and hope for a resolution soon. Many thanks for the article
(google does bring up excellent results)
Jose
November 16th, 2005 at 7:09 pm
The fix worked like a charm Chris! Thank you. It is very strange though that the auto-mapping of the CFIDE directory in CF Administrator doesn’t fix this problem. That makes it a bug in CF. You shouldn’t have to have CFIDE in your webroot. It is a huge security risk.
November 17th, 2005 at 4:41 pm
Exposing /cfide/scripts/ to the web root doesn’t seem to be too much of a security flaw. Most of the files in there appear to be files that are supposed to be accessible by browsers anyway.
January 9th, 2006 at 1:00 pm
I have a development machine and what I thought was an identical production machine running CFMX 7. I was having the same issues you were. Thanks you your site you pointed me in the right direction. One thing though, since I have full access to the server, I just created a virtual directory on the site I was working on pointing to CFIDE. Not sure why it wasn’t on that site, but don’t think I would have thought of it if it wasn’t for your site. Thanks!
May 2nd, 2006 at 2:07 pm
This is a great tip… I was running into this issue on some servers and not others, and never had time to track down the problem.
If you opt to FTP CFIDE into your web root on a Virtual Host, I reccomend deleting everything except the scripts file for security and size reasons, especially the administrator folder.
June 26th, 2006 at 10:10 am
Great article, lead me in the propoer direction. As a further tip, make sure when you establish the cfide directory you give it the permission to execute scripts and executables, if you don’t – you’ll still recieve the obnoxious error ‘lc_1′ not defined, also and maybe I’m just paranoid from past experiences if its ucase CFIDE make it that way for the virtual as well no telling when it will be important.
August 11th, 2006 at 9:29 am
The recommended solution work for me on my server.
Thank you!
Tony
February 25th, 2007 at 8:32 pm
Thanks for this tip.. it saved me!
April 18th, 2007 at 11:27 pm
some file /cfide/scripts can’t call
it have in real folder
but can access
August 5th, 2008 at 12:16 pm
This is exactly what the problem was. Thanks!