0 Replies - 878 Views - Last Post: 29 January 2014 - 07:48 PM Rate Topic: -----

#1 saadaslam  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 05-October 12

Triple Chained/Related Selects in ColdFusion Error Invoking CFC

Posted 29 January 2014 - 07:48 PM

Using a AJAX Based Triple Chained/Related Selects in Cold Fusion

I am getting Error Invoking CFC : Internal Server Error Adding cfdebug tag doesn't help

The Triple Chained/Related Select works fine, but generates the error. How can I make stop it from happening. I believe my CFC is coded correctly

Any help will be appreciated

Already Tried bindonload=false for Second Select Does not help Also Tried bindonload=false for First Select Options dont load

Main goal is to get the value not the id #

Here is my code

CFC:

<cfcomponent output="false">

<!--- Get array of media types --->
<cffunction name="getDevice" access="remote" returnType="array">
    <!--- Define variables --->
    <cfset var data="">
    <cfset var result=ArrayNew(2)>
    <cfset var i=0> 

    <!--- Get data --->
    <cfquery name="data" datasource="#dsn#">
    SELECT device_id, device_list
    FROM pa_device
    ORDER BY device_list
    </cfquery>

    <!--- Convert results to array --->
    <cfloop index="i" from="1" to="#data.RecordCount#">
        <cfset result[i][1]=data.device_id[i]>
        <cfset result[i][2]=data.device_list[i]>
    </cfloop>

    <!--- And return it --->
    <cfreturn result>
</cffunction>

<!--- Get art by media type --->
<cffunction name="getProblem" access="remote" returnType="array">
    <cfargument name="device_id" type="numeric" required="true">

    <!--- Define variables --->
    <cfset var data="">
    <cfset var result=ArrayNew(2)>
    <cfset var i=0>

    <!--- Get data --->
    <cfquery name="data" datasource="#dsn#">
    SELECT problem_id, problem_list
    FROM pa_problem
    WHERE device_id = #ARGUMENTS.device_id#
    ORDER BY problem_list
    </cfquery>

    <!--- Convert results to array --->
    <cfloop index="i" from="1" to="#data.RecordCount#">
        <cfset result[i][1]=data.problem_id[i]>
        <cfset result[i][2]=data.problem_list[i]>
    </cfloop>

    <!--- And return it --->
    <cfreturn result>
</cffunction>


  <!--- Get art by media type --->
<cffunction name="getdescription" access="remote" returnType="array">
    <cfargument name="device_id" type="numeric" required="true">
    <cfargument name="problem_id" type="numeric" required="true">

    <!--- Define variables --->
    <cfset var data="">
    <cfset var result=ArrayNew(2)>
    <cfset var i=0>

    <!--- Get data --->
    <cfquery name="data" datasource="#dsn#">
    SELECT description_id, description_list, device_id
    FROM pa_description
    WHERE device_id = #ARGUMENTS.device_id# and problem_id =#arguments.problem_id#
            ORDER BY description_list
    </cfquery>

    <!--- Convert results to array --->
    <cfloop index="i" from="1" to="#data.RecordCount#">
        <cfset result[i][1]=data.description_id[i]>
        <cfset result[i][2]=data.description_list[i]>
    </cfloop>

    <!--- And return it --->
    <cfreturn result>
</cffunction>

CFM:
 <cfform>

    <table>
    <tr>
    <td>Select Device Type:</td>
    <td><cfselect name="device"
            bind="cfc:art.getDevice()"
            bindonload="true" /></td>
</tr>
<tr>
    <td>Select Problem Type:</td>
    <td><cfselect name="problem"
            bind="cfc:art.getProblem({device})" 
            bindonload="false" /></td>
</tr>
<tr>
    <td>Select Description Type:</td>
    <td><cfselect name="description"
            bind="cfc:art.getdescription({device},{problem})" 
            bindonload="false"/></td>
 </tr>
 </table>


Thanks

Is This A Good Question/Topic? 0
  • +

Page 1 of 1