Seamus Campbell wrote: > Hi > > I've got a field called category - which can have multiple > parent_categories. > I want to display all the parent_categories a category has in a > drop down box in a form. > I can only get it to show ONE parent_category. > Below is my current code - can anyone give a clue as to how to show > multiple parent_categories, please
From a quick review of the code, it looks like the problem is the line: <CFIF get_parent_categories.parent_category_id IS get_this_parent_categories.parent_category_id>SELECTED</CFIF> That line is only going to select the item which matches the first parent_category_id from get_this_parent_categories query. If you want to match all the parent categories, one way would be to change it to something like: <!---before your cfoutput---> <cfset parentcategorylist = valuelist(get_this_parent_categories.parent_category_id)> <!---Then change the comparison to---> <CFIF listfind(parentcategorylist,get_parent_categories.parent_category_id)> SELECTED</CFIF> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255785 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4