开发者

ColdFusion <cfselect> binding Error

开发者 https://www.devze.com 2023-03-13 14:19 出处:网络
I am trying to populate a drop down list based on the user\'s selection made in the previous drop down list. Both drop down lists are in the same form. Each drop down list is to be populated with a 2-

I am trying to populate a drop down list based on the user's selection made in the previous drop down list. Both drop down lists are in the same form. Each drop down list is to be populated with a 2-dimensional array containing information from a database passed within a cffunction (getClients) within a cfcomponent (EasySelection). The following error appears when I attempt to run the page in my browser (latest version of FireFox). I have also tried replacing the bind attribute's code with the following: "cfc:bindFcns.getClients()" ...in which I receive the same error message.

Here is the Error Message below:

The specified CFC EasySelection could not be found.
The path to the CFC must be specified as a full path, or as a relative path from the current template, without the use of mappings.

The error occurred in C:\workspaces\jackscotty\timecard.dev\webroot\timetotals\index.cfm: line 180
   178 : <td colspan="2">
   179 : <cfSELECT NAME="paramCompanyID" 
   180 : **bind="cfc:EasySelection.getclients()" bindOnLoad="true">**
   181 : <OPTION VALUE="-1" SELECTED>Any</OPTION>
   182 : </cfSELECT>

In case it is more helpful, here is my code for EasySelection.cfc:

<cfcomponent output="false">
  <cffunction name="getclients" access="remote" returntype="array">
      <CFQUERY NAME="qGetClients" DATASOURCE="#application.DSN#">
          SELECT * FROM companies 
          WHERE clientflag = 1 
          ORDER BY company 
      </CFQUERY>
      <cfset count = 1 />
      <cfset clientresults = arraynew(2) />
      <cfloop query="qGetClients">
          <cfset clientresults[count][1]="#companyid#" />
          &开发者_运维问答lt;cfset clientresults[count][2]="#companyid#" />
          <cfset count= count+1 />
      </cfloop>
      <cfreturn clientresults />
  </cffunction>
  <cffunction name="getprojects" access="remote">
      <cfargument name="companyid" type="string" required="yes" />
      <cfquery name="qGetProjects2" datasource="#application.DSN#">
          SELECT * FROM projects
          WHERE companyid = '#companyid#'
          ORDER BY companyid
      </cfquery>
      <cfset count = 1 />
      <cfset projectresults = arraynew(2) />
      <cfloop query="qGetProjects2">
          <cfset projectresults[count][1]="#projectid#" />
          <cfset projectresults[count][2]="#projectid#" />
          <cfset count= count+1 />
      </cfloop>
      <cfreturn projectresults>
  </cffunction>
</cfcomponent>

Your help is greatly appreciated! Thanks for your time.


Is your EasySelection cfc in the timetotals directory? As the error states, you need to specify the full path to the CFC. So for example, if your CFC is in a "cfcs" directory in the root of your site, you would specify it as cfc:cfcs.EasySelection. By specifying it as cfc:EasySelection ColdFusion will check the root directory, and the current directory "timetotals" in this case.


Provide full path of your cfc. If you your EasySelection is under CFC folder then it should be cfc:cfc.EasySelection. If you are running under localhost with seperate directory then you may need write something like cfc:[your application folder path].cfc.EasySelection.

In short you need to provide relative path of cfc from root of your website.

0

精彩评论

暂无评论...
验证码 换一张
取 消