Data binding 启用Application.cfc时,cfc中的cfselect bind不起作用

Data binding 启用Application.cfc时,cfc中的cfselect bind不起作用,data-binding,coldfusion,coldfusion-10,cfselect,Data Binding,Coldfusion,Coldfusion 10,Cfselect,我正在尝试创建一个表单,其中有3个选择框绑定到cfc三重相关的cfselect。如果我删除Application.cfc,代码运行正常,选择框会提供我需要的数据。但是,当我添加Application.cfc时,它具有cflogin功能,要求用户在能够使用任何页面之前登录,而我的三重相关选择框不再起作用。选择框只是没有给出函数中查询的任何数据。它仍然连接到函数页面,因为当我更改cfselect绑定上的名称时,它会让我知道该函数在组件中不存在。我不确定我必须做什么才能使三重相关的cfselect与c

我正在尝试创建一个表单,其中有3个选择框绑定到cfc三重相关的cfselect。如果我删除Application.cfc,代码运行正常,选择框会提供我需要的数据。但是,当我添加Application.cfc时,它具有cflogin功能,要求用户在能够使用任何页面之前登录,而我的三重相关选择框不再起作用。选择框只是没有给出函数中查询的任何数据。它仍然连接到函数页面,因为当我更改cfselect绑定上的名称时,它会让我知道该函数在组件中不存在。我不确定我必须做什么才能使三重相关的cfselect与cflogin一起工作。 我正在使用ColdFusion 10 我非常感谢你的建议。 谢谢,妮娃

我添加了代码: 这是表格上的代码

<tr valign="top">  
    <td style="color:DarkSeaGreen; font-weight:bold; width=100">Product Type:</td>
    <td width="200">
    <cfselect name="Selproducttype" bind="cfc:groupfnc.getproducttypeid()"
        display="description" value="producttypeid" BindOnLoad="true"/></td></tr>
<tr valign="top">  
    <td style="color:DarkSeaGreen; font-weight:bold; width=100">Vendor:</td>
    <td width="200">
    <cfselect name="Selvendor" bind="cfc:groupfnc.getven({Selproducttype})"
        display="fullname" value="vendorid" BindOnLoad="true"/></td></tr>   

<tr valign="top">  
    <td style="color:DarkSeaGreen; font-weight:bold; width=100">Product:</td>
    <td width="200">

<cfselect name="Selprod" bind="cfc:groupfnc.getprod({Selvendor})"
        display="fullname" value="productid" BindOnLoad="true" /></td></tr>
<tr valign="top">  
    <td style="color:DarkSeaGreen; font-weight:bold; width=100">Sub Product:</td>
    <td width="200">
    <cfselect name="Selsubprod" bind="cfc:groupfnc.Getsub({Selprod})"
        display="fullname" value="productsubid" /></td></tr>
组件上的代码:groupfnc.cfc

  <cffunction name="getproducttypeid" access="remote" output="false" returntype="query">
<cfquery name="listproducttype" datasource="xxxxxx">
    Select distinct producttypeid, (Case when producttypeid = '101' then 'Hotel' 
                         when producttypeid='201' then 'optionalTour' 
                         when producttypeid = '301' then 'Transporation' 
                         when producttypeid = '501' then 'MISC'
                         when producttypeid = '601' then 'OTH' end) as description
    From products
</cfquery>
<cfreturn listproducttype />
</cffunction>

<cffunction name="getven" access="remote" output="false" returntype="Query">
    <cfargument name="Selproducttype" type="any" required="true">
    <cfif ARGUMENTS.Selproducttype EQ "">
    <cfset ARGUMENTS.Selproducttype = '0'>
    </cfif>
    <cfquery name="listven" datasource="xxxxxx">
    SELECT distinct vendors.fullname, vendors.vendorid 
    from vendors, products
    where products.vendorid= vendors.vendorid
    and  products.producttypeid = #ARGUMENTS.Selproducttype#
    ORDER BY fullname
    </cfquery>
    <cfreturn listven />
</cffunction>


<cffunction name="getprod" access="remote" output="false" returntype="Query">
    <cfargument name="Selvendor" type="any" required="true">
    <cfif ARGUMENTS.Selvendor EQ "">
    <cfset ARGUMENTS.Selvendor = '0'>
    </cfif>
    <cfquery name="Lstprod" datasource="xxxxxx">
    Select productid, fullname from products
    where vendorid = #ARGUMENTS.Selvendor#
    order by fullname
    </cfquery>
    <!---</cfif>--->
    <cfreturn Lstprod />
</cffunction>    
<cffunction name="Getsub" access="remote" output="false" returntype="Query">
    <cfargument name="Selprod" type="any" required="true">
    <cfif ARGUMENTS.Selprod EQ "">
    <cfset ARGUMENTS.Selprod = '0'>
    </cfif>
    <cfquery name="Lstsubprod" datasource="xxxxxx">
    Select productsubid, fullname from productsubs
    where productid = #ARGUMENTS.Selprod#
    order by fullname
    </cfquery>
    <!---</cfif>--->
    <cfreturn Lstsubprod />
</cffunction>
这是我的申请表

  <cfcomponent> 
   <cfset This.name = "Orders"> 
   <cfset This.Sessionmanagement="True"> 
   <cfset This.loginstorage="session"> 

     <cffunction name="OnRequestStart"> 

       <cfargument name = "request" required="true"/> 
         <cfif IsDefined("Form.logout")> 
          <cflogout> 
        </cfif> 

    <cflogin> 
       <cfif NOT IsDefined("cflogin")> 
         <cfinclude template="loginform.cfm">

          <cfabort> 
       <cfelse> 
        <cfif cflogin.name IS "" OR cflogin.password IS ""> 

            <cfoutput> 
                <h2>You must enter text in both the User Name and Password fields. 
                </h2> 
            </cfoutput> 
              <cfinclude template="loginform.cfm">
            <cfabort> 
        <cfelse> 
            <cfquery name="loginQuery" dataSource="xxxxxx"> 
            SELECT userid, roles 
            FROM logininfo 
            WHERE 
                userid = '#cflogin.name#' 
                AND upassword = '#cflogin.password#' 
            </cfquery> 
            <cfif loginQuery.roles NEQ ""> 
                <cfloginuser name="#cflogin.name#" Password = "#cflogin.password#" 
                    roles="#loginQuery.roles#"> 
            <cfelse> 


                <cfoutput>
                    <H2>Your login information is not valid.<br> 
                    Please Try again</H2> 
                </cfoutput>     
               <cfinclude template="loginform.cfm">  
                <cfabort> 
            </cfif> 
        </cfif>     
      </cfif> 
  </cflogin> 

   <cfif GetAuthUser() NEQ ""> 
     <cfoutput> 

            <form action="securitytest.cfm" method="Post"> 
            <input type="submit" Name="Logout" value="Logout"> 
        </form> 

       </cfoutput> 
  </cfif> 

 </cffunction> 
</cfcomponent>

我发现了问题。因为在我的Application.cfc中有以下部分:

因此,在查看ajax响应时,注销表单被放置在INFORT中,因此选择框没有解析该值。我在Application.cfc中删除了该部分,页面运行正常。 非常感谢你的帮助!
^_^

没有代码,很难帮助您。浏览器开发工具显示了什么?控制台应该显示ajax请求和响应。我还建议您停止使用cfselect、cfform等,只编写自己的Javascript。jQuery将使这变得非常简单,您不必依赖CF的内置垃圾。您是否查看过Firebug,以反思背景Ajax请求及其返回?也许您在application.cfc中定义了onRequest,但不是onCFCRequest?如果看不到代码和请求/响应详细信息,就很难帮助您进行故障排除。我添加了代码。jQuery对我来说是新事物,我对它不是很熟悉。当我有更多的时间时,我会尝试一下jQUery。我以前没有使用过firebug,我会尝试一下。我的Application.cfc中没有太多内容,只有cflogin函数,我从adobe帮助中复制了它。我需要在我的Application.cfc中添加一些东西吗?好的,我通过Firebug运行代码,结果如下:当我从服务器上删除Application.cfc时,我运行页面,选择部分,例如producttype部分,它显示在下面,下面列出了查询中的所有选项。当我将Application.cfc放回到服务器上时,select部分只有一个选项,没有任何选项。
        <form action="securitytest.cfm" method="Post"> 
        <input type="submit" Name="Logout" value="Logout"> 
    </form> 

   </cfoutput>