(Long e-mail but simple problem)

I'm having problems pre-checking checkboxes based on a three-table
arrangement.  The "Contacts" table holds all the company-specific
info...

Contacts
=========
ContactID
ContactInfo
etc


The "CompanyTypes" table lists all the different services a company can
offer, eg Architect, Consultant, Contractor, etc...

CompanyTypes
============
CompanyTypeID
CompanyType


and the third table, "CompanyActivities" effectively joins the other two
tables together, so that one company can be listed as offering several
different services:

CompanyActivities
===============
ContactID
CompanyTypeID




I need to create an "Edit this company's details" page which lists *all*
the different CompanyTypes (Architect, Consultant, Contactor) as
checkboxes with the correct ones for each company pre-checked.

If you query the CompanyTypes table to get all the different services,
comme ca:

<CFQUERY DATASOURCE="#application.DataSource#" NAME="GetCompanyTypes">
   SELECT CompanyTypes.CompanyTypeID,
      CompanyTypes.CompanyType
   FROM CompanyTypes
</CFQUERY>

and then query the third table to see which services any selected
company offers:

<CFQUERY DATASOURCE="#application.DataSource#"
NAME="GetCompanyActivities">
   SELECT CompanyActivities.ContactID,
       CompanyActivities.CompanyTypeID
FROM CompanyActivities
WHERE CompanyActivities.ContactID = #URL.ContactID#
</CFQUERY>

how on earth do you output the results?  My best attempt so far only
checks one box (the first)...

<CFOUTPUT QUERY="GetCompanyTypes">
<INPUT TYPE="checkbox" NAME="CompanyTypeID" VALUE="#CompanyTypeID#"<CFIF
GetCompanyActivities.CompanyTypeID IS GetCompanyTypes.CompanyTypeID>
CHECKED</CFIF>>
</CFOUTPUT>

because the query on the third table retreives this recordset

CompanyID 1    1        (1 = Architect)
CompanyID 1    2        (2 = Consultant)
CompanyID 1    10      (10 = Project Management)



Thanks if anyone can help on this stumper...

--
Aidan Whitehall  <[EMAIL PROTECTED]>
The Net Profits Internet Services
ColdFusion website development, domain names, hosting and tuition
Tel: +44 (0) 1695 50050  (North West England)

the force behind ...
http://www.softwaresavings.co.uk/
http://www.fairbanks.co.uk/
http://www.gardenmagic.co.uk/
http://www.bodytherapy.co.uk/
http://www.kktoiletries.co.uk/
http://www.maharishischool.com/





------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to