I handle this in a different way. Here's what I would do:
<cfquery name="getAllCats" datasource="#application.DSN#">
SELECT CategoryID, Category
FROM tblClientCategoryTypes
</cfquery>

<cfquery name="getCats" datasource="#application.DSN#">
SELECT ClientID, CategoryID
FROM tblClientCategory
WHERE ClientID=#FORM.ClientID#
</cfquery>
<!---Create a list of selected categories--->
<cfset selectedcats = valuelist(getcats.categoryid)>
<form action="action.cfm" method="post">
<!---Output all categories, checking for the the selected categories.--->
<cfoutput query="getallcats">
<input type="checkbox" name="CategoryID" value=""
<CFIF listfind(selectedcats, categoryid) GT "0">checked</CFIF>><br>
</cfoutput>
</form>

Make sense? If you're doing this a lot, you might want to make the list an
array, which will process a bit faster, but if it's a short list, I don't
bother.

-Deanna






************************************************************
Deanna Schneider
Interactive Media Developer
UWEX Cooperative Extension Electronic Publishing Group
103 Extension Bldg
432 N. Lake Street
Madison, WI 53706
(608) 265-7923




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to