CFOUTPUT Query variable name doesn't work on CF11 Linux
Copy link to clipboard
Copied
I am trying to reference a query from a struct and use it in other cfm files but I get this error message from CF11 Linux:"Attribute validation error for tag cfoutput. The value of the attribute query, which is currently Application.SRS.RequestTypes, is invalid.'
It works on CF9 window server.
Here are the code:
<!--- entry-sr.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: query statement
<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>
query-to-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>
Copy link to clipboard
Copied
Case-sensitivity perhaps? What happens if you change all occurrences of the relevant names into small letters? That is,
<CFQuery Name="requesttypes" DataSource="#Application.SRS.AppDataSource#" BlockFactor="100">
<CFSET Application.SRS.RequestTypes = requesttypes>

