Link to home
Start Free TrialLog in
Avatar of Lee R Liddick Jr
Lee R Liddick JrFlag for United States of America

asked on

CFWINDOW causing "Error processing JavaScript..."

Every time I click on the image that fires the onclick javascript for CFWINDOW I get the following message:
("Error processing JavaScript in markup for element crdata_body: [Enable debugging.....]")

Now, I only get this the first time I click on the image button.  But when I refresh the page and click on my image button again, I get the error again.

<CFAJAXIMPORT TAGS="cfwindow">
<cfwindow x="210" y="100" width="960" height="500" name="crdataedit"
        title="Call Routing Data" initshow="false"
        source="windowTestedit.cfm"
        modal="true" />
<cfwindow x="210" y="100" width="960" height="500" name="crdataview"
        title="Call Routing Data" initshow="false"
        source="windowTestview.cfm"
        modal="true" />

<IMG SRC="../images/btn_edit2.gif" TITLE="Edit CDN/VDN" STYLE="cursor:hand;" ONCLICK="javascript:ColdFusion.Window.show('crdataedit')">
<IMG SRC="../images/btn_view2.gif" TITLE="View CDN/VDN" STYLE="cursor:hand;" ONCLICK="javascript:ColdFusion.Window.show('crdataview')">

Open in new window

Avatar of cfEngineers
cfEngineers

onclick assumes that you are using javascript so change

ONCLICK="javascript:ColdFusion.Window.show('crdataedit')">

to

ONCLICK="ColdFusion.Window.show('crdataedit')">
Avatar of Lee R Liddick Jr

ASKER

I tried that...still get the same message.
In one if your windowTestedit or windowTestview cfm files, you most likely have some javascript functions that look like this

function test(id){
}

when they should look like this

test = function(id){
}

This is known to cause JS errors in CF using AJAX.
This is really all I have in the test files right now...
<!---- content of windowTestview.cfm file ----->
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/screen.css">
</head>
<body style="width:850;">
<CFAJAXIMPORT TAGS="cflayout-tab,cfform,cfwindow">
<h3>Main page input:</h3>
<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">
    <CFLAYOUTAREA name="tab1" TITLE="Basic Data">
        Put all the basic information about the VDN here.
    </CFLAYOUTAREA>
    <CFLAYOUTAREA name="tab2" TITLE="Hours of Operation">
        Put the Hours of Operation data here.
    </CFLAYOUTAREA>
    <CFLAYOUTAREA name="tab3" TITLE="Technical Data">
        Put the technical data of the VDN here.
    </CFLAYOUTAREA>
</CFLAYOUT>
</body>
</html>

Open in new window

Put all your cfajaximport tags in the main page
Avatar of gdemaria
The CFAJAXIMPORT  belongs in your main page, not in the page that uses cflayout.

Also, you don't need to reference cfwindow because it is in the main page (assuming that is the main page).

and remove CFAJAXIMPORT from your windowTestEdit.cfm file


<CFAJAXIMPORT TAGS="cflayout-tab,cfform">
<cfwindow x="210" y="100" width="960" height="500" name="crdataedit"
        title="Call Routing Data" initshow="false"
        source="windowTestedit.cfm"
        modal="true" />
        
<cfwindow x="210" y="100" width="960" height="500" name="crdataview"
        title="Call Routing Data" initshow="false"
        source="windowTestview.cfm"
        modal="true" />

<IMG SRC="../images/btn_edit2.gif" TITLE="Edit CDN/VDN" STYLE="cursor:hand;" ONCLICK="javascript:ColdFusion.Window.show('crdataedit')">
<IMG SRC="../images/btn_view2.gif" TITLE="View CDN/VDN" STYLE="cursor:hand;" ONCLICK="javascript:ColdFusion.Window.show('crdataview')">

Open in new window

Okay...I removed the CFAJAXIMPORT off the windowTest pages.  I removed the cfwindow from the CFAJAXIMPORT on the main page (data_manager.cfm).  Still getting the popup error.  Does the CFAJAXIMPORT tag need to be in a specific place on the file or something?  
add &cfdebug=1  to the URL and try again,  a window should appear that will show you a better error

The error may be in your test.cfm pages, it could be a simple type-o.  You can try reducing those pages to just "hello world" and see if that works as a quick test...  (comment out the rest)
I have tried the ?cfdebug=1 and ?cfdebug=true before and nothing would ever popup.  I have commented out everything off my windowTest page and just put Hello World... and I still get the same popup error...  
Make sure you have the debugging turned on in your /CFIDE/administrator

I would leave the Hello World in the test page until we get the error sorted out, just to reduce possible factors.   Because if the called page has an error, you could see a pop-up error like that.

I notice the error is mentioning  crdata_body rather than crdataEdit_body.  The cfwindow's name is crdataedit, I am wondering why it says crdata_.... instead, do you have anything called crdata on the page as well?

I have asked our administrator to turn it on...

and that was a typo...the error is crdataEdit_body.  I double checked my code and the cfwindow and the window.show shows the same.
The code below is my main page 'data_manager.cfm' and my window page 'windowContentA.cfm' code.  This is what I get in the AJAX Logger window when I click on the main page link to the window:

info:http: Replaced markup for element: crdedit_body
error:http: Error processing JavaScript in markup for element crdedit_body:
info:widget: Window shown, id: crdedit
info:http: HTTP GET windowContentA.cfm?_cf_containerId=crdedit_body&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=F1DC1A1496BFE163D562F5BDC5D0FDC1&_cf_rc=0
info:http: Replacing markup for element: crdedit_body from URL windowContentA.cfm with params _cf_containerId=crdedit_body
info:widget: Creating window: crdedit
info:LogReader: LogReader initialized
info:global: Logger initialized

<!--- main page, data_manager.cfm ----->
<CFAJAXIMPORT TAGS="cflayout-tab,cfform">
<cfwindow x="210" y="100" width="960" height="500" name="crdedit"
        title="Call Routing Data" initshow="false"
        source="windowContentA.cfm"
        modal="true" />

<IMG SRC="../images/btn_edit2.gif" TITLE="Edit CDN/VDN" STYLE="cursor:hand;" ONCLICK="javascript:ColdFusion.Window.show('crdedit')">

<!---- contents of windowContentA.cfm ----->
Hello World...
<!---- I also have rem out 
<h3>Main page input:</h3>
<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">
    <CFLAYOUTAREA name="tab1" TITLE="Basic Data">
        Put all the basic information about the VDN here.
    </CFLAYOUTAREA>
    <CFLAYOUTAREA name="tab2" TITLE="Hours of Operation">
        Put the Hours of Operation data here.
    </CFLAYOUTAREA>
    <CFLAYOUTAREA name="tab3" TITLE="Technical Data">
        Put the technical data of the VDN here.
    </CFLAYOUTAREA>
</CFLAYOUT>
----->

Open in new window

Does any of this make sense?
Does anyone care at this point?  Hahahahahaha
Should I give up at this point and find another way to do this?  This makes no sense as to why it doesn't work and throws up that error.  I have searched and searched over the net and I have coded it exactly the way I have it.  No other code is bumping off of it becuase it's the only code on the pages.  None of the other suggestions in any of the other blog and posting sites have worked for me.  Is there another way to get the 'modal' type window to work other than CFWINDOW?

Sorry, I was away.  

I took your code and set it up on my server to give it a test.   I got the same error when I did not have the windowContentA.cfm  created yet.    But after the pop-up error, the screen showed the debug informaton "File Not Found..."   Do you have coldfusion debugger on?   I would think you would see the error message (or a different one) as well.   This is the regular debugger that shows the queries and execution code at the bottom of every page..  is that on?

When I put the file in place, everything worked perfectly.   Check to see if your file is in the same folder as your cfwindow file.   If not add a relative path to the pop-up file.

If this doesn't work, make sure debugger is on and look for error message on the screen.  Also, let me know what folder the two files are in.
Not a problem...My cf debugger was on but its off now...it is a shared server and the company turns it off after the day...i have to submit another ticket to get them to turn it back on.  In any case, I didn't see any errors in the cf debugger.  My windowContentA.cfm file is in the same folder as the data_manager.cfm.  I'm at a loss at this point.

I was rereading the thread and noticed that you said the error only happens the first time you click the button (first time on each page load).   Is that still the case?   If so, what if you wait a few extra seconds before clicking it?  Perhaps the js libraries are loading slowly?
try adding cfwindow to <CFAJAXIMPORT TAGS="cflayout-tab,cfform">
That is correct...and I just waited about 3-4 minutes after the page loaded.  No change.
@cfEngineers...I have done that, no change.  

I have even moved my two test pages to my production site and tried it there too...still the same thing.
Because you are calling javascript ColdFusion.Window. you have to have cfwindow in your <CFAJAXIMPORT TAGS="cflayout-tab,cfform">

set your initshow to true for both to see if they show up without error
I have already set the initshow to true and same thing...
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Using the CFINCLUDE did it...for goodness sakes.  Thanks for the persistance...I wish I could give more points out for this!
Such persistance in assisting with this!  Thank you so much!!!
Phew!  Glad it worked.

Just a note about CFAJAXIMPORT, a lot of things were tried here, so to just clear that up.  CFAJAXIMPORT goes into the main file and only needs to reference CF ajax components that are inside of the CFWINDOW.   So if your WindowContentA.cfm file calls a layout tab or a CFform, you need to include those two elements in your CFAJAXIMPORT.  

Hope that makes sense.

Regards,
Yes it does...thanks again qdemaria!