Learn how to a build a cloud-first strategyRegister Now

x
  • 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!
             Sincerely,
                   JL
0
jl_forum
Asked:
jl_forum
  • 3
  • 3
1 Solution
 
MartinCMSCommented:
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
</CFQUERY>

<TABLE align="CENTER" width="98%">
<TD align="CENTER" height="100" valign="MIDDLE">
      <CF_TWOSELECTSRELATED
      query="TestSelection"
      name1="Part_Num"
      name2="Typer"
      display1="Part_Num"
      display2="Typer"
      value1="Part_Num"
      value2="Typer"
      forcewidth1="60"
      forcewidth2="60"
      htmlbetween="</TD><TD ALIGN='CENTER' VALIGN='MIDDLE'>"
      AutoSelectFirst="No">
</TD>
</TABLE>

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

http://projects.nateweiss.com/nwdc/workcode.htm
0
 
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.
             Sincerely,
                   JL
0
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.

 
kkhippleCommented:
have a look at the following links


very easy and quick way to set up dynamic drop down lists
http://tutorial166.easycfm.com/

Pull down list based on the selection in another pull down list
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_21084413.html


populate select list based on other list selection
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_21066907.html
0
 
MartinCMSCommented:
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

0
 
jl_forumAuthor Commented:
Martin,
    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....
           Thanks,
                 JL
0
 
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?

Line:20
Error: Object expected

Any ideas? Thanks.
0

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