Hi

I have 3 tables:  (Access database)

tblClient  has fields:
ClientID
ClientEmail
ClientName
....

tblClientCategory  has fields:
ClientID
CategoryID

tblClientCategoryTypes  has fields:
CategoryID
Category

So clientID can have one or more Categories.

I am trying to build an edit form so that on editing a single ClientID you 
see all categories (with checkboxes) in tblClientCategoryTypes  but have 
checked only those where there is a corresponding CategoryID in 
tblClientCategory .

I can only get my form to check the first corresponding record. This is my 
code (I'm sure that I need to cfloop in the form but am having huge problems.

<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>

<form action="action.cfm" method="post">
<cfloop query="getAllCats">
<cfoutput>#Category# </cfoutput><cfloop index="CategoryID" list="getCats">
<input type="checkbox" name="CategoryID" value="" <CFIF 
#getAllCats.CategoryID# IS #getCats.CategoryID#>checked</CFIF></cfloop>><BR>
</cfloop>
</form>

Any help gratefully received. I can understand conceptually how looping 
works but have have huge problems implementing anything that works.
MTIA
Seamus


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

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to