Previous versions of ColdFusion, ie: pre-CFMX, generated the CFFORM validation JavaScripts on the fly. CFMX differs in that it now included in a seperate file "cfform.js" in the CFIDE/scripts folder.

Unfortunately you might, as I am, be using a shared hosting environment (often called "multi-homed" where, for good reason, the CFIDE folder is not accessible as a web folder in the usual way. Often the hosting provider will password protect the CFIDE folder our move it out of a web accessible folder altogether.

The same thing applies to the CFWDDX tag so if you are having a similar issue the fix is the same(ish).

Step 1:

Upload the CFFORM.JS file (located in your localhost/cfide/scripts folder) to your web site root.

Step 2:

In your "application.cfm" template add the following line of code. You may need to adjust the IP address but try 127.0.0.1 by default as this will usually work in a hosted environment anyway.

<cfparam name="Request.CFFORM_JS_Lib" type="string" default="http://127.0.0.1/cfform.js">

Make sure the CFFORM.JS file is located in your web site root or in a subdirectory (adjust the URL if needed).

Step 3:

Now replace your existing opening CFFORM tag with the following:

<cfform scriptsrc="#Request.CFFORM_JS_LIB#" ...>

The scriptsrc attribute is new to CFMX. Use the other CFFORM attributes (name, enctype, etc) as you normally would except that under CFMX the method="post" attribute has been deprecated and is no longer required except.

Your CFFORMs should now work as they always did previously and you will no longer receive embarrassing JS error alerts.

 

About This Tutorial
Author: Peter Tilbrook
Skill Level: Beginner 
 
 
 
Platforms Tested: CFMX
Total Views: 116,066
Submission Date: July 08, 2003
Last Update Date: June 05, 2009
All Tutorials By This Autor: 5
Discuss This Tutorial
  • That would work but MX 7.0.1 has other files it needs to - especially if you use Flash or XML forms. I posted this over 3 years ago of course. Now I just copy the contents of the CFIDE/scripts folder into a "scripts" folder in my site and use the updated CFFORM tag like this:

  • Do We Need to upload FullCFIDE or JUST Scripts Folder

  • Usually you would totally restrict access to the CFIDE folder which is why the scriptsrc attribute of CFFORM can be handy. Russ's solution would work but why would you want a CFIDE folder as part of your website? Why not just say have a scripts or lib folder and whack all your UDF's and JS files in that? Different with CF7? I know some new tags will be available with the CF7.01 updater so will look at updating this tutorial. My main post was to point out why you might get the error and how to get around it. Cheers!

  • The above worked when I was on 6.1 but failed on MX7 but when I uploaded the CFIDE folder it worked. I am on a shared hosting and well, I am the hosting provider and need to maintain security. What risk's are evloved here?

  • The easiest solution is to make your own CFIDE folder in your webroot and upload the required files from the coldfusion CFIDE folder here. You now do not need to change anything.

Advertisement

Sponsored By...
Mobile App Development (IOS, Android, Cordova, Phonegap, Objective-C, Java) - Austin, Texas Mobile Apps - Touch512, LLC.