Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Populate drop down by another drop down

Hi guys,
     Its another question about ColdFusion. Sorry about being a ColdFusion newbie. I need to know how to populate a drop down list from another drop down list. For example, I have a table named Plan that contains uniquely identifying fields Part_Num and Typer (both of which comprise the PK). I want to be able to select a Part_Num from a list (select distinct Part_num from Plan), and have the selection dynamically populate a second drop box (select distinct Typer from Plan where Part_Num = '[ENTER SELECTION CHOSEN FROM FIRST DROP BOX]'). I want to do that within the same page without refreshing the page if possible. Could someone please provide the code to do this? Thanks!
  • 3
  • 3
1 Solution
Sound like using CF_TwoSelectsRelated custom tag  should work for you.

<CFQUERY NAME="TestSelection" DATASOURCE="yourDataSource">
 SELECT distinct Part_Num,Typer
 FROM Plan
 ORDER BY Part_Num,Typer

<TABLE align="CENTER" width="98%">
<TD align="CENTER" height="100" valign="MIDDLE">
      htmlbetween="</TD><TD ALIGN='CENTER' VALIGN='MIDDLE'>"

you can download the free CF_TwoSelectsRelated custom tag using the link below if have not already have the tag.

jl_forumAuthor Commented:
Hi Martin,
    I had actually looked at this tag before submitting my question to EE. I didn't understand what I was supposed to do to this code. It appears to be a template and I just have to fill items in. However, I am unsure of what to do and the "directions" don't make much sense to me. Remember, I'm pretty much a newbie. Can you tell me what to do? Thanks.
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

have a look at the following links

very easy and quick way to set up dynamic drop down lists

Pull down list based on the selection in another pull down list

populate select list based on other list selection
JL - What Coldfusion Version are you using?

If you have V5.0, then the custom tag CF_TWOSELECTSRELATED is already build in for you.  You can use my example above to get you selection works.

If you are using V4.5, then there's a default folder for custom tag   "C:\CFusion\CustomTags" - u'll need to store ur files from the zip file you download from the link above there

jl_forumAuthor Commented:
    I tried pasting your code. All I get is a white screen even though I have it in the custom tags directory and am using Coldfusion MX 6.1 (Trial). Any ideas? I don't see a table or anything on screen....
jl_forumAuthor Commented:
Nevermind.. my mistake! Thanks! It works... however, an error message always appears when I use it. Its a runtime error from IE... it may just be my IE?

A Runtime Error has occured.
Do you wish to Debug?

Error: Object expected

Any ideas? Thanks.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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