Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

3 dropdown menus

Hallo experts.
I have found this solution:
http://www.experts-exchange.com/Software/Server_Software/Web_Servers/ColdFusion/Q_20398517.html?sfQueryTermInfo=1+3+dropdown#a7452940
 from exp. TallerMike.
What can be the cfquery for this example?.(......>You would need to select the data for all 3 fields all at once<........).
(i use cf8)
0
Panos
Asked:
Panos
1 Solution
 
Russell2566Commented:
I don't think the accepted solution really covers what was needed for that question, but let me see if I can complete it.

To do it this way without using an AJAX solution (which is what this screams for) you will need 3 queries. In the header of the page you will need to generate 2 sets of associative JavaScript arrays for the second two drop downs.

<script>
      aProducts = new Array();
      <cfoutput query="qProducts" groupBy="vendorName">
            aProucts["#qProducts.vendorId#"] = new Array();
            <cfoutput>
                  aProducts["#qProducts.vendorName#"].push({id:"#qProducts.productId#", name:"#qProduct.productName#"});
            </cfoutput>
      </cfoutput>
</script>

Then on the onChange event in the first drop down you would need a function that would grab what the newly selected vendor was. In case your wondering thats an object I'm pushing to the Array in the generated JavaScript code. so you when adding options to the select box you can set the value = to aProducts["vendorA"][20].id and the text = to aProducts["vendorA"][20].name...

I hope this helps!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now