Being that CFAJAX is setup to have your CFC methods return strings.....
What we use is a cftry/cfcatch block (in the method you are calling) and in the
CFCATCH block we have wrapped CFSAVECONTENT around a CFDUMP of the CFCATCH
struct and return the resulting variable. This results in an HTML string being
returned containing a dump of the error details as reported by CFCATCH.
Like so:
<cfcatch type="any">
<cfsavecontent variable="theError">
<cfdump var="#cfcatch#">
</cfsavecontent>
<cfreturn theError>
</cfcatch>
HTH
Cheers
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.com
----- Original Message -----
From: "Adkins, Randy" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Monday, June 19, 2006 1:15 PM
Subject: AJAX
> Is there a way to debug CFAJAX? I am calling the function and it seems
> to be working (yes, I did get the examples to work), but my fields are
> not being populated.
> I tested the query to insure there were results and there are. It will
> run the loading message and then nothing. I can not get it to populate
> any fields. Just wondering if there is something I am missing?
>
>
> MAIN FILE:
> --------------------------------------------
> <!--- Include CFAjax core files --->
> <script type='text/javascript' src='/cfajax/core/engine.js'></script>
> <script type='text/javascript' src='/cfajax/core/util.js'></script>
> <script type='text/javascript' src='/cfajax/core/settings.js'></script>
>
> <script language="javascript">
> function getMfgDetails(vSelectBox) {
> alert("Run Script 1 - "+vSelectBox.value);
>
> DWREngine._execute(_cfscriptLocation, null, 'assetData',
> vSelectBox.value, DisplayMfgData);
> }
> function DisplayMfgData(qData) {
> DWRUtil.setValue("txt2Row1", qData[0].MNAME);
> DWRUtil.setValue("txt3Row1", qData[0].MNUM);
> DWRUtil.setValue("txt4Row1", qData[0].SNUM);
> return;
> }
>
> </script>
>
>
> On this file I do have the OnChange event being triggered by calling:
> getMfgDetails(this);
>
>
>
> FUNCTIONS.CFM
> ------------------------------------------------------------------------
> --
> <cfinclude template="/cfajax/core/cfajax.cfm">
> <cffunction name="assetData" returntype="query">
>
> <cfargument name="ItemID" required="yes" type="numeric" hint="Item
> Number of the Asset">
>
> <cfset var qMfgData2 = "">
> <cfset var qReturn = "">
>
> <cfquery datasource="IMS" name="qMfgData2" maxrows=1>
> SELECT serial_num, manf, model_num FROM assets
> WHERE ID = <cfqueryparam value="#arguments.ItemID#"
> cfsqltype="cf_sql_integer">
> </cfquery>
>
> <cfscript>
> // Create the query to return
> qReturn = QueryNew("mName,mNum,sNum");
> QueryAddRow(qReturn, 1);
> QuerySetCell(qReturn, "mName", qMfgData2.manf);
> QuerySetCell(qReturn, "mNum", qMfgData2.model_num);
> QuerySetCell(qReturn, "sNum", qMfgData2.serial_num);
> </cfscript>
>
> <cfreturn qReturn>
> </cffunction>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244150
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54