Skip to main content
Participant
September 15, 2009
Question

Using Combo Box selection in query

  • September 15, 2009
  • 1 reply
  • 667 views
Greetings!

Check this out...

<cfoutput>
<form name="myForm" id="myForm" method="post">
<SELECT NAME="pickMe">
<cfloop query="marksTest">
<OPTION value="#marksTest.EXPLOIT#">#UCase(marksTest.EXPLOIT)#</OPTION>
</cfloop>
</SELECT>
</form>
</cfoutput>

<cfif isDefined("form.pickMe")>

<cfquery name="marksTest" dbType="query">
   SELECT *
   FROM myquery
</cfquery>

<cfdump var="#marksTest#">

</cfif>

What I am trying to accomplish is that when the user makes a choice from the combo box it is used to perform a query. Am I on the right track here? Any tips or suggestions will be greatly appreciated. Thanks!
    This topic has been closed for replies.

    1 reply

    September 16, 2009

    If you are trying to assign the query result to any textbox or anyother field while making a combobox selection, you can just try this..

    Assign the query result to be populated to the combobox value field using a pipe symbol

    <option  value="OriginalValue|#marksTest.column#>Texttodisplay</option>

    On the onchange of combobox, you can call a js function, split to get the second portion of the value of combobox and assign it to whicever field required.

    This will simulate assigning the query result on combo selection