CFOUTPUT查询变量名称在CF11 Linux

时间:2015-08-28 00:14:15

标签: coldfusion

我正在尝试从结构中引用查询并在其他cfm文件中使用它但我从CF11 Linux获得此错误消息:“标记cfoutput的属性验证错误。属性查询的值,当前是应用程序。 SRS.RequestTypes无效。'

适用于CF9窗口服务器。

以下是代码:

entry.cfm

<script type="text/javascript">
    function setTypeDesc( request_type ) {
      <CFOutput Query="Application.SRS.RequestTypes">
        if ( request_type == "#request_type_code#" ) {
          document.getElementById( "TypeDesc" ).innerHTML = "#JSStringFormat( request_type_desc )#";
        }
      </CFOutput>
      if ( request_type == "A" ) {
        document.getElementById( "Developer_Label" ).className = "req";
        this.form.Developer.value = '#UCase( Request.LogonID )#';
        this.form.Developer.onblur();
      } else {
        document.getElementById( "Developer_Label" ).className = "";
      }
    }
  </script>

load-type.cfm:查询语句

<CFQuery Name="RequestTypes" DataSource="#Application.SRS.AppDataSource#" BlockFactor="100">
    SELECT 
    FROM srs_type
    ORDER BY request_type_code
</CFQuery>
<CFLock Timeout="60" ThrowOnTimeout="Yes" Type="EXCLUSIVE"  Scope="APPLICATION">
    <CFSET Application.SRS.RequestTypes = RequestTypes>
    <CFModule Template="#Application.ModuleDir#/query-to-struct.cfm"
        DataQuery="#RequestTypes#"
        KeyFieldList="request_type_code"
        VariableName="Application.SRS.RequestTypesStruct">
</CFLock>

查询 - struct.cfm:

<CFParam Name="Attributes.DataQuery" Type="query">
<CFParam Name="Attributes.KeyFieldList" Type="string">
<CFParam Name="Attributes.VariableName" Type="string">

<CFSET ResultStruct = StructNew()>
<CFOutput Query="Attributes.DataQuery">
    <CFSET KeyString = "">
    <CFLoop List="#Attributes.KeyFieldList#" Index="field">
        <CFSET KeyString = ListAppend( KeyString, Evaluate( field ) )>
    </CFLoop>
    <CFSET ResultStruct[KeyString] = StructNew()>
    <CFLoop List="#Attributes.DataQuery.ColumnList#" Index="col">
        <CFSET ResultStruct[KeyString][col] = Evaluate( col )>
    </CFLoop>
</CFOutput>

<CFIF Attributes.VariableName contains ".">
    <CFSET "#Attributes.VariableName#" = ResultStruct>
<CFELSE>
    <CFSET "Caller.#Attributes.VariableName#" = ResultStruct>
</CFIF>

0 个答案:

没有答案