cfform JavaScript error “‘lc_id’ is undefined”

Friday, April 8th, 2005

I 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:

Error: 'lc_id' is undefined

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.)

Technorati Tags: , , , , , , , , ,

14 Responses to “cfform JavaScript error “‘lc_id’ is undefined””

  1. Roger G Says:

    This ‘tip’ worked fine for me, thanks!

  2. fg Says:

    fgj

  3. Chris Peters Says:

    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. :)

  4. Chris Peters Says:

    Very detailed post, addressed the problem, thank you much.

  5. Jose Diaz Says:

    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

  6. yukonzach Says:

    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.

  7. Chris Peters Says:

    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.

  8. Alex Grosholz Says:

    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!

  9. westfork Says:

    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.

  10. Dave Says:

    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.

  11. Tony Says:

    The recommended solution work for me on my server.

    Thank you!

    Tony

  12. TalWar_ Says:

    Thanks for this tip.. it saved me!

  13. Pp Says:

    some file /cfide/scripts can’t call
    it have in real folder
    but can access

  14. Phalanx Says:

    This is exactly what the problem was. Thanks!

Leave a Reply