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

Dynamically Display Names From Second Query Based On Select List Selection

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#">
SELECT *
FROM dbo.lkp_NotifierCats
WHERE type = 'IncidentReport'
ORDER BY Category ASC
</cfquery>

*** 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
</cfquery>

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

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!
Phil
0
SiriusPhil
Asked:
SiriusPhil
  • 3
1 Solution
 
ExpertAdminCommented:
If you are using CF7, you can query your query for matches.

http://store1.adobe.com/devnet/server_archive/articles/query_caching_cf.html

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.

M@
0
 
ExpertAdminCommented:
Well, considering that I am the only one who responded to this one, I am thinking the points should go to me.

M@
0
 
ExpertAdminCommented:
Thank you.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

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