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
jl_forumAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.