Results 1 to 2 of 2

Thread: Can get this simple cfc to work.

  1. #1
    Join Date
    Aug 2012
    Posts
    2

    Default Can get this simple cfc to work.

    Hi, I am trying to run this code which includes a simple call to a cfc. The idea here is to type something into the input box, press the ok button, reply "ok" to the confirm box and have the cfc return what was typed. Very simple, just doing this to later update an application to use components. When the cfc returns the text, I get this error on my left bottom portion of my browser and the reply from the cfc is not displayed. Any suggestions, by the way, this work just fine on another CF site.

    Message: Exception thrown and not caught
    Line: 804
    Char: 1
    Code: 0
    URI: http://www.istarlightcommunications....kage/cfajax.js

    cfm page:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <cfajaxproxy cfc="mytestcfc" jsclassname="mytestcfc" />
    <title>Test CFC</title>

    <script language="JavaScript1.2" type="text/javascript">
    function showUpdtDetail(r)
    {

    alert(r);
    }

    function Verify()
    {

    var chk;
    chk=confirm("Are you sure you want to Test CFC Call");
    if(chk == true)
    {
    var instance = new mytestcfc();
    instance.setCallbackHandler(showUpdtDetail);
    instance.myFunction(document.getElementById("testi nput").value);
    }
    else return false;
    }
    </script>
    </head>

    <body>
    <cfform name="myfrm">
    <cfinput name="testinput" id="testinput"><br />
    <cfinput type="button" Value="Test CFC Call" name="delbtn" id="delbtn" onclick="javascript:Verify()" >
    </cfform>

    </body>
    </html>

    cfc page:

    <cfcomponent>
    <cffunction name="myFunction" access="remote" output="false" returntype="string">
    <cfargument name="myArgument" type="string" required="yes">
    <cfreturn myArgument>
    </cffunction>
    </cfcomponent>

  2. #2
    Join Date
    Aug 2012
    Posts
    2

    Default Working now

    Thanks to David D. on the Hostek Support Team for helping me figure this out. Seems I had a couple of things in my directory that were causing my components not to compile, notably an "Onrequestend.cfm" with a <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> declaration tag. I removed that tag from my files as I had it in multiple places and all seems to be working great. David also turned me on to this little trick that really helped. To see if your cfc will compile, add "?wsdl" to your cfc link. It will return xml code if it compiles or an error message to help you debug.

    http://www.yoursite.com/ajax/yourcfc.cfc?wsdl

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •