On a form. When someone selects on option from a select dropdown, I want the other drop down to change and only show some of the options based on the first dropdown selection.
This has in the past been referred to as “two selects related”, and there have been CF-oriented resources (articles, blog posts) written over the years using various techniques, such as based on Ajax or not (including whether using CF-specific ajax features, or not).
Here are a few you can consider. I have not reviewed them to confirm they all work currently (but you don’t say what version of CF you use). And note that sometimes they may complain about a problem that was true then but is fixed since, such as easily creating json from a query, which is now an option on cfquery itself (or queryexecute), as of CF2021:
https://yiengly.wordpress.com/2017/08/15/populating-a-related-select-using-jquery-in-coldfusion/
https://www.raymondcamden.com/2014/05/30/Related-selects-with-multiple-options
https://stackoverflow.com/questions/49124480/how-to-created-related-select-lists
and a blast from the past (2007):
https://forta.com/2007/05/31/coldfusion-ajax-tutorial-2-related-selects/
Even the CF Docs have coverage of approached that could work, but the presentation is rather obtuse and buried within/surrounded by other topics even on each of the following single pages:
Those are a few to hopefully get you going. Please let us know if any works out well for you (or not).
You must be logged in to post a comment.