Dynamically Display Names From Second Query Based On Select List Selection

Posted on 2006-05-19
Last Modified: 2013-12-24
I have two ColdFusion queries.  The first populates a list of possible report categories.  The seconds contains a table of one or more names per category that should be notified of the report on submission.  I simply want to dynamically display the names on the form as the category changes.  Can someone help with the Javascript for this?

****QUERY 1:  Gets me the categories ****
<cfquery name="GetCats" datasource="#application.dsn#">
FROM dbo.lkp_NotifierCats
WHERE type = 'IncidentReport'

*** QUERY 2:  Gets me ALL possible combinations of email addresses to be notified based on the Catid***
<cfquery name="ToNotify" datasource="#application.dsn#">
SELECT dbo.tbl_Users.fname, dbo.tbl_Users.lname, dbo.tbl_Users.UniqueID
FROM dbo.tbl_NotifyMatch, dbo.tbl_Users
WHERE dbo.tbl_Users.UserID = dbo.tbl_NotifyMatch.userID

*** Here is my list***
<select name="CatID" id="CatID">
                      <option value="">Select One</option>
                      <cfoutput query="GetCats">
                        <option value="#GetCats.CatID#">#GetCats.Category#</option>

Based on the selection in the list, I want to display:
<cfoutput query="ToNotify">#ToNotify.fname# #ToNotify.lname#</cfoutput>
but again... only display those that match (one or more names) the category selected.

Thanks in advance!
Question by:SiriusPhil
    LVL 7

    Accepted Solution

    If you are using CF7, you can query your query for matches.

    You can cache the query, then when the user selects a value, you can use that selected form value to requery the existing query results and use the SECOND query to populate your other select.

    Hope this helps.

    LVL 7

    Expert Comment

    Well, considering that I am the only one who responded to this one, I am thinking the points should go to me.

    LVL 7

    Expert Comment

    Thank you.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now