Skip to main content
Known Participant
June 6, 2017
Question

ColdFusion 2016 cfajaxproxy Invalid usage of AJAX tag

  • June 6, 2017
  • 6 replies
  • 2853 views

We have a web app running on CF10.  When trying to migrate it to CF2016 update 4, we have a cfajaxproxy that is generating the following error.

Invalid usage of AJAX tag.

Use cfajaximport tag to specify SCRIPTSRC or make sure all ajax controls are inside a single cfform tag that has SCRIPTSRC.

We are running on IIS 8.5 on Windows 2012 R2.  The website has a virtual directory /cf_scripts in IIS pointing to D:\ColdFusion2016\cfusion\wwwroot\cf_scripts and I can call any of the scripts directly through the web browser and see the JS.

This topic has been closed for replies.

6 replies

Known Participant
July 31, 2019

I tried to be 100% sure that everything is in the right place and then I tested it again and it still did not work. I suspect that there is something about this that is related to yui though. When I removed the cfajaximport statement, it appeared to fail looking for a file in the yui structure. When I put the yui back it didnt do that, but it left me with a blank area. Sorry if this is confusing--it is for me too.

I will try to create a small sample of the problem.

Charlie Arehart
Community Expert
Community Expert
July 31, 2019

Right, I thought I had seen a reference to YUI in one of the earlier error messages, which is another reason I pressed on this (though I don’t see it now).

Anyway, I will do so one more time, for your sake. Your note here says you “tried to be 100% sure all was right”, which sounds like you mean you re recollecting that it seemed right. Given that, I will say that if you find you can’t create that simple test (or indeed, before trying), you may want to follow what I said and try it again, and just be 100% sure things look like how I described.

Totally your call, of course. As always, I just want to help.

/Charlie (troubleshooter, carehart. org)
Known Participant
August 3, 2019

I've figured out what happened and it comes down to the way I coded the cfajaximport statement. As I indicated above, my statements look like this: <cfajaximport tags="cfform, cfwindow, cfdiv" scriptsrc="/CFIDE/scripts">

I wrote this a few years back and don't know why I had the scriptsrc parameter, but probably found it on sample statements in some documentation. The location of those scripts has now moved, so this was pointing to a non-existent place. Of course I didn't need to include the scriptsrc parameter at all. By removing it, it looks to be working in both CF10 and CF2016.

The second issue to comment on is the yui libraries. I have been getting 2 error messages for missing yui scripts (yahoo-dom-event and animation). As far as I can tell these play no part in any of my programming. But I installed the yui libraries anyway and the error messages went away, with no other effect.

Known Participant
July 29, 2019

I seem to have the same problem. I just set up a new CF 2016 development system and updated it to the latest maintenance. Code that has been working for years with a CFAJAXPROXY now generates that same error message as others have reported. Specifically I get this message: "Invalid usage of AJAX tag.

Use cfajaximport tag to specify SCRIPTSRC or make sure all ajax controls are inside a single cfform tag that has SCRIPTSRC."

It fails on the cfajaximport line below:

<cfwindow closable="true" draggable="true" modal="true" name="NAWindowEdit" resizable="false"

title="Update Name & Address" width="400" height="480" x="400" y="100"

bodyStyle="font-size:12px; font-family: verdana; color: black; text-align: left;"

    headerStyle="font-size:13px; font-weight:bold; font-family:Verdana; background-color: ##003399; color: white; text-align:left;">

    <cfajaximport tags="cfform, cfwindow, cfdiv" scriptsrc="/CFIDE/scripts">

    </cfwindow>

This seems like rather straightforward coding ... am I doing something wrong that CF 2016 now catches?

Known Participant
July 29, 2019

You need the patch.

Yes 2016 now catches stuff.

We stopped using the code that was causing the problem.

But can use it.

Been 18 months ... would have to a) find it and b) ask Adobe if it was meant for general release ... I know we paid a small fortune for it and then had them tell us it wasn't a bug.  Then what would you call it?

Known Participant
July 29, 2019

I seem to have the same problem. I just built

Participating Frequently
June 7, 2017

I have a similar problem.  Our ColdFusion 2016 server was just upgraded to Update 4 from the previous ColdFusion 2016 update.  Before that, the cfajaxproxy worked fine, but now, I'm getting an error that a parameter to my cfc function is required, but not passed in.  None of the code has changed at all...just the update was installed.

This is the definition:

<cfajaxproxy cfc="lims.com.qry_userDAO" jsclassname="Users">

Known Participant
June 7, 2017

Did rolling back resolve your issue?  Ours did not seem to correct.

Participating Frequently
June 7, 2017

We have not been able to try that yet, but it was working before the update and that is the only thing that has changed on the server.

Known Participant
June 6, 2017

Here is the code snippet of includes.  The error appears at the first cfajaxproxy.  If I remove the first one, the error moves to the next.  I have tried adding a cfajaximport tag before the cfajaxproxy tag and that would generate the same error message.

The CFC's are pretty simple and functions have access set to remote.

<cfinclude template="/headers/meta.cfm">
<cfinclude template="/headers/javascript.cfm">
<cfajaxproxy cfc = "members.login.userCheck" jsclassname = "tryLogin">
<cfajaxproxy cfc = "emails.compose.autoSaveComp" jsclassname = "compAutoSave">
<cfajaxproxy cfc = "members.memberFunctions" jsclassname = "memberFunctions">
<cfajaxproxy cfc = "committees.committee_functions" jsclassname = "committeeFunctions">
<cfajaxproxy cfc = "forums.forum_functions" jsclassname = "forumFunctions">
Inspiring
June 6, 2017

You will need to show us some code.

Although the code might not have changed during the migration, the way you coded it in CF10 may have been incorrect, CF10 allowed it (as a bug) but they fixed it going forward which means CF2016 is a lot more stricter.