Question
cfselect bind value for query field
I have two cfselect drop downs. The first is populated by a
query in a cfc. The return is a list of field names. I would like
the user to be able to select from the first cfselect <field
name> and populate the second cfselect with the values from a
query that used the field name selected from the first cfselect
choice.
Is this possible and how do I accomplish this? I keep getting an error: "...values returned from getValues function is not of type query..."
Thanks for any help.
here is the code:
<cffunction name="getFields" access="remote" returntype="string">
<cfargument name="search5" type="any" required="false" default="">
<!--- Define variables --->
<cfset var result="">
<!--- Do search --->
<cfquery name="fieldNameQry" datasource="Livermore_SQL">
select *
from LU_Assessor
order by FieldNameLU
</cfquery>
<!--- And return it --->
<cfreturn ValueList(fieldNameQry.FieldNameLU)>
</cffunction>
<cffunction name="getValues" access="remote" returntype="string">
<cfargument name="search6" type="any" required="false" default="">
<!--- Define variables --->
<cfset var result="">
<!--- Do search --->
<cfquery name="valuesQry" datasource="Livermore_SQL" maxrows="20">
select #ARGUMENTS.search6#
from CITY
</cfquery>
<!--- And return it --->
<cfreturn ValueList(search6)>
</cffunction>
<tr>
<td>
<cfselect name="FieldName" style="font-size: 10px;"
query="fieldNameQry"
value="FieldNameLU" display="FieldNameLU">
<option selected>Select Field...</option>
</cfselect>
</td>
<td>
<cfselect name="ValueLU" style="font-size: 10px;"
bind="cfc:srchValues.getValues({FieldName})" bindonload="false">
<option selected>Values...</option>
</cfselect>
</td>
</tr>
Is this possible and how do I accomplish this? I keep getting an error: "...values returned from getValues function is not of type query..."
Thanks for any help.
here is the code:
<cffunction name="getFields" access="remote" returntype="string">
<cfargument name="search5" type="any" required="false" default="">
<!--- Define variables --->
<cfset var result="">
<!--- Do search --->
<cfquery name="fieldNameQry" datasource="Livermore_SQL">
select *
from LU_Assessor
order by FieldNameLU
</cfquery>
<!--- And return it --->
<cfreturn ValueList(fieldNameQry.FieldNameLU)>
</cffunction>
<cffunction name="getValues" access="remote" returntype="string">
<cfargument name="search6" type="any" required="false" default="">
<!--- Define variables --->
<cfset var result="">
<!--- Do search --->
<cfquery name="valuesQry" datasource="Livermore_SQL" maxrows="20">
select #ARGUMENTS.search6#
from CITY
</cfquery>
<!--- And return it --->
<cfreturn ValueList(search6)>
</cffunction>
<tr>
<td>
<cfselect name="FieldName" style="font-size: 10px;"
query="fieldNameQry"
value="FieldNameLU" display="FieldNameLU">
<option selected>Select Field...</option>
</cfselect>
</td>
<td>
<cfselect name="ValueLU" style="font-size: 10px;"
bind="cfc:srchValues.getValues({FieldName})" bindonload="false">
<option selected>Values...</option>
</cfselect>
</td>
</tr>
