Quantcast
Channel: Adobe Community : Discussion List - ColdFusion
Viewing all articles
Browse latest Browse all 6243

How to display values from cfquery based on dropdown selection?

$
0
0

Hello everyone, I'm trying to display values based on drop down selection. So I give to user few different ways how they can pick the customers. First option is to select all customers and in that case I should get all of them from qryCustomers displayed in drop down Select Customer. If they select just Male I should change my list of records in Select Customer Drop Down. Same thing should happen for Age. So I'm no sure what is the best way to get this to work. Any advise or help will be good. Thanks in advance.  

 

Here is example of my code:

 

<cfquery name="qryCustomers" datasource="Project">

  Select CustomerID, (FirstName + ' ' + LastName) as Name, Age, Gender

  From Students

  Order by Name;

</cfquery>

 

<tr>

  <th>All Customers</th>

    <td>

          <select name="AllCustomerss" id="AllCustomerss">

               <option value="N">No</option>

               <option value="Y">Yes</option>

           </select>

    </td>

  </tr>

  <tr>

    <th>Gender</th>

      <td>

         <select id="Gender" name="Gender">

            <option value="">--Please Select a Gender--</option>

            <option value="M">Male</option>

            <option value="F">Female</option>

          </select>

       </td>

  </tr>

  <tr>

      <th>Age</th>

       <td>

            <select id="Age" name="Age">

               <option value="">--Please Select Age--</option>

                <cfloop index="i" from="#qryAge.LowAge#" to="#qryAge.HighAge#">

                 <cfoutput>

                      <option value="#i#">#i#</option>

                 </cfoutput>

                </cfloop>

             </select>

         </td>

  </tr>

  <tr>

       <th>Select Customer</th>

        <td>

            <select id="CustomNames" name="CustomNames" multiple>

              <cfoutput query="qryCustomers">

                   <option value="#CustomerID#">#Name#</option>

              </cfoutput>

             </select>

        </td>

  </tr>


Viewing all articles
Browse latest Browse all 6243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>