Solved

Coldfusion 8 Ajax and CFIDE as Virtual Folder throwing a javascript error

Posted on 2007-11-20
15
1,994 Views
Last Modified: 2013-12-24
For some strange reason I have a website that is unable to access the CF8 Ajax scripting libraries.

The website is not set up as the default website on the server (IIS 6.0 , Windows 2003), and the the CFIDE directory is virtual folder under that website.  Everything works inculding form field validation, Flash forms and so on, the only thing that doesnt is Ajax.  CFdiv would be a good example.  I get back and error for something as simple as

<cfdiv bind="url:TestPage.cfm"></cfdiv>

The error I get back is "Error processing Javascript markup for element cf_div1195589780172: [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]"

Adding ?cfdebug=1 just gave me the same error.

This code does work however under the default website.  I checked security settings for the virtual directory and there is read and script access to the entire directory, so not sure what else I should be looking at to get this working.

0
Comment
Question by:Michin
  • 8
  • 6
15 Comments
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 20339973
Are you certain that the CFIDE directory you have created a virtual directory to contains all of the files in the /CFIDE/Scripts/ folder? the /CFIDE/Scripts/ folder should contain 1,887 files and 250 folders. if it only has 2 files then your virtual directory is pointed to an old version of the cfide directory.
0
 
LVL 2

Author Comment

by:Michin
ID: 20340448
hmm ok I did a check and it contains 2,954 Files and 397 Folders.

It definitely has something to do with permissions I'm just not sure what it is.

I'm fairly certain that the appropriate rights are set, but not 100% sure since its not working.

But cfform.js is working without any issue as well as all the masks so not sure.

Virtual Directory is fairly straight forward, but here is an image of what I have in the way of setup.

http://66.193.54.196/untitled-1.gif 

This is exactly mimicked from the default website where ajax doesnt' give the error.
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 20340851
You should leave the "Script Source Access" box unchecked. Enabling that setting gives people access to your source code which is a pretty big security risk.

Are the 2,954 Files and 397folders in the /CFIDE/Scripts folder or the whole /CFIDE/ directory. If you were just counting the Scripts folder then you have too many files in there if you are counting the whole CFIDE Directory then it looks like you have a few extra files and folders but the numbers are pretty close. I would suggest you use FireFox, Install the FireBug add on (https://addons.mozilla.org/en-US/firefox/addon/1843) and then use that to help you figure out if any particular files are missing.



0
 
LVL 2

Author Comment

by:Michin
ID: 20340995
Indeed, the scripts folder does have 1887 files and 250 folders so thats all good.  I was looking at the CFIDE dir before.

I went ahead and ran the page in firefox with firebug installed, but same errors.

Now I was messing arounf though and found something interesting.  The pag eI am trying to run is in a directory of the web www.domain.com/dir/

But if I move the page our of the sub directory and run it at the root it works.  I went ahead and tried fiddling with scriptsrc to see if that might be the issue  

<cfajaximport tags="cfdiv" scriptsrc="/../CFIDE/Scripts">
<cfajaximport tags="cfdiv" scriptsrc="../CFIDE/Scripts">
<cfajaximport tags="cfdiv" scriptsrc="/CFIDE/Scripts">

None worked.

Even tried creating a virtual directory CFIDE int he sub directory and that didnt work.
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 20341322
when you are adding ?cfdebug=1 to your url and getting the same error, do you also have debugging enabled in coldfusion administrator?

you need to check the " Enable AJAX Debug Log Window " box on the " Debugging & Logging > Debug Output Settings" page in the administrator for the ?cfdebug=1 to work properly
0
 
LVL 2

Author Comment

by:Michin
ID: 20341569
well I found what was causing this error, but cant seem to fix it.

It seems if I put in javascript at the top fo the page that does somethign else it interferes with the CF8 ajax.

In this case its for a dhtml menu

  <SCRIPT TYPE="text/javascript">
  var dmWorkPath="data.files/";
  </SCRIPT>

  <SCRIPT TYPE="text/javascript" SRC="data.files/dmenu.js"></SCRIPT>
0
 
LVL 2

Author Comment

by:Michin
ID: 20341710
ok so I know whats going on now, but have no idea why or how to resolve it.

If I have something on the page like

<SCRIPT TYPE="text/javascript">
  alert('test');
  </SCRIPT>
 
 <cfajaximport tags="cfdiv">
<cfdiv bind="url:GetPorts.cfm"></cfdiv>

Everything works great, but if I take out the alert javascript from this page and put it into the application.cfm I get the error.
0
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

 
LVL 14

Expert Comment

by:Scott Bennett
ID: 20352882
Does the GetPorts.cfm that is bound to the cfdiv tag use the dhtml menu javascript?
0
 
LVL 2

Author Comment

by:Michin
ID: 20353040
No the getports.cfm script just queries a database select count(*) as qryCount and then just does <cfoutput>#qrycount#</cfoutput>

the dhtml script wasnt the issue, the issue seemed to be putting any kind of javascript in the appliction.cfm file, have no idea why or how to resolve it but thats what causes the error to pop up.
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 20353720
It could be that the javascript files you are using have a javascript variable name that is conflicting with one of the coldfusion or something.

You shoudn't be putting any display code in your application.cfm file, that's a pretty standard best practice "no no". Try putting that code into a header file that you include with each request. you might also try putting your other javascript into a function and then using the AjaxOnLoad function to execute the dhtml menu stuf after the ajax stuff is done loading.

http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_a-b_06.html#5178573
0
 
LVL 2

Author Comment

by:Michin
ID: 20378046
Well it isnt variables in the javascript because the below code doesnt work as well.

<SCRIPT TYPE="text/javascript">
  alert('test');
  </SCRIPT>

I have also tried in a heade rnot in application.cfm and that doesnt work either.  The code has to actually be in the processing page, not in any includes or in application.cfm

so what I ended up doing was just offloading all my javascript i put in the header and application.cfm and put it in the main page and it all works.

0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 20378620
I did actually run accross a similar  issue the other day with some javascript that wasn't working correctly with the th cfgrid tag I was working on, then the strange thing is I moved the javascript in between the <head></head> tags and then it all started working fine. try putting all your javascript in the head and see if it helps.
0
 
LVL 2

Author Comment

by:Michin
ID: 20379611
hmm ya they are already between the <head> tags, tried moving gthem out though and same issue..wow frustrating  
0
 
LVL 2

Accepted Solution

by:
kc5sig earned 500 total points
ID: 21395121
Not sure if you found the solution to this or not but I'll add in my own recent experience and see if it helps -

I'm working on a CFTree and could not get the HTML version to come up.  Turns out that CF8 has some conflicting Javascript.

I was able to see the AJAX tree when I changed my debugging settings from Dockable.cfm to Classic.cfm in the debugging settings.
0
 
LVL 2

Author Closing Comment

by:Michin
ID: 31410251
aha! that worked
0

Featured Post

Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
question about access to website 2 68
Autoresponder for Whole Domain in Plesk/Cpanel 2 68
CFFILE upload help 98 138
Need help with EXECUTE sp_executesql in ColdFusion cfquery 10 27
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now