• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfselect bind value for query field

Guest
Oct 17, 2008 Oct 17, 2008

Copy link to clipboard

Copied

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>
TOPICS
Advanced techniques

Views

888

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2008 Oct 18, 2008

Copy link to clipboard

Copied

Look at the returntype attribute of your cffunction tag.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 22, 2008 Oct 22, 2008

Copy link to clipboard

Copied

Dan,

Thanks for the suggestion and I can get it to work if the returntype is set to query, but only if I declare the field and display values in the second cfselect. I would really like the value and display paramaters of the second cfselect to be variables - because there are a few different possiblities. Is this possible?

For example the first cfselect selection will determine what field will be queried and then returned to the second cfselect.

Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2008 Oct 27, 2008

Copy link to clipboard

Copied

I ended up accomplishing this by creating an array and then passing the array to the drop down.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 30, 2009 Jan 30, 2009

Copy link to clipboard

Copied

LATEST
I am having this same problem, do you have an example of how you got this done?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation