Data binding CFSelect不会从cfc返回数据

Data binding CFSelect不会从cfc返回数据,data-binding,coldfusion,cfc,cfselect,Data Binding,Coldfusion,Cfc,Cfselect,我想将此cfc绑定到我的cfselect: 这是我的cfc代码: <cfcomponent output="false"> <cffunction name="getrates" returntype="query" output="false" access="remote"> <cfargument name="productno" required="yes" default="0" hint="Need productno."> <cfset v

我想将此cfc绑定到我的
cfselect

这是我的cfc代码:

<cfcomponent output="false">
<cffunction name="getrates" returntype="query" output="false" access="remote">
<cfargument name="productno" required="yes" default="0" hint="Need productno.">
<cfset var getrate = "">
<cfquery name="getrate" datasource="xxxxxx">
     select distinct  ratecode, b.rateid as rateid
     from productnos a , rates b
     where a.productid = b.productid and a.productsubid = b.productsubid
        and a.productno = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.productno#">
        and (b.validto is null or b.validto > '2013-09-01')
</cfquery>
<cfreturn getrate> 
</cffunction>
</cfcomponent>

选择不同的费率代码,b.rateid作为费率ID
来自产品编号a,费率b
其中a.productid=b.productid和a.productsubid=b.productsubid
和a.productno=
和(b.validto为空或b.validto>'2013-09-01')
这是我的test.cfm代码:

 <CFPARAM name="FORM.productnumber" default="">
 <cfif structKeyExists(form,'submit') >
<cfset productno = #FORM.productnumber#>
 <table border="1" cellpadding="5" cellspacing="0" bordercolor="SeaGreen">  
   <tr>  
       <td colspan="2" bgcolor="DarkSeaGreen" style="color:Snow; font-size:large" align="center">  
         Choose Option For Tour 
            </td>  
         </tr>  
         <tr valign="top">  
            <td style="color:DarkSeaGreen; font-weight:bold">  
            Select Option  
            </td>  
            <td >  
            <cfform name="selectrate" method="post" format="html">  
                <cfselect name="rateid" bind="cfc:pricelist.getrates({productno})" display="ratecode" value="rateid" bindonload="yes" />

            </cfform>  
             </td>  
        </tr>  
    </table>  

<br />

<CFELSE>
 <CFOUTPUT>
  <cfform  action="testniva.cfm" method="POST">
    <p>Please enter the product number<br />
      <!--- include the most recent value of the submitted form, if you like, by simply setting the value to the variable --->
       <cfinput type="text" name="productnumber"></p>
       <p><cfinput type="submit" name="submit" value="Submit"></p>
   <p><cfinput type="reset" Name="Reset" value="Cancel">    </p>
   </cfform>
 </CFOUTPUT>
</CFIF>     

选择旅游选项
选择选项

请输入产品编号


我无法绑定
cfselect
,因为它说
productno未定义。不知道我需要做什么。如果我将
bind=“cfc:pricelist.getrates({productno})
替换为
bind=“cfc:pricelist.getrates(101)
,那么它将绑定,因此我认为
productno
某种程度上没有结转。

没关系,我发现了问题。我需要将bindonload放入cfselectFYI中,对于您显示的代码,似乎没有理由让它成为Ajax调用,因为查询不是动态的。实际上,我想做的是创建一个带有文本框的自提交表单询问productno,将productno传递给cfselect,但是我在传递变量时遇到了困难。你能告诉我需要做什么才能让绑定识别我的变量吗。我编辑了代码的原始帖子。想创建一个正确的答案,然后将其标记为已回答吗?