Good afternoon,
This is my first post and I didn't find any submission guidelines for including
code, so I'm going to try it "as is" just to get my question out there.
I have two checkbox groups that insert multiple values into a database just
fine. I am having trouble getting more checkboxes than the first record to be
checked when I pull the information from the database for the update/edit form
for administrators.
I have one table that has 9 values and their names for reference
(targetAudience) and one table that stores the values from the form associated
with a primary key (audienceValues). The insert from the user submitted form
adds a row for each checkbox selected with the same resource ID as the primary
key into the "audienceValues" table.
Here's my code:
<!--- Pulls data from the audience values table --->
<cfquery name="qUpdateAudienceValues" datasource="#dsn#">
SELECT *
FROM audienceValues, targetAudience
WHERE rid = '#url.did#'
AND audienceValues.taid = targetAudience.taid
</cfquery>
<!--- Target Audience Checkboxes --->
<td>
<label><input type="checkbox" id="generalPub"
name="targetAudience" value="1" <cfif #qUpdateAudienceValues.taid# EQ
1>checked="checked"</cfif> />General Public(Adults)</label><br />
<label><input type="checkbox" id="children"
name="targetAudience" value="2" <cfif #qUpdateAudienceValues.taid# EQ
2>checked="checked"</cfif> />Children ⁄ Youth</label><br />
<label><input type="checkbox" id="seniors"
name="targetAudience" value="3" <cfif #qUpdateAudienceValues.taid# EQ
3>checked="checked"</cfif> />Seniors</label><br />
<label><input type="checkbox" id="officials"
name="targetAudience" value="4" <cfif #qUpdateAudienceValues.taid# EQ
4>checked="checked"</cfif> />Elected Officials ⁄ Policy
Makers</label><br />
<label><input type="checkbox" id="extension"
name="targetAudience" value="5" <cfif #qUpdateAudienceValues.taid# EQ
5>checked="checked"</cfif> />Extension
Educators ⁄ Teachers</label><br />
</td>
<td>
<label><input type="checkbox" id="disaster"
name="targetAudience" value="6" <cfif #qUpdateAudienceValues.taid# EQ
6>checked="checked"</cfif> />Disaster Professionals</label><br />
<label><input type="checkbox" id="farmers"
name="targetAudience" value="7" <cfif #qUpdateAudienceValues.taid# EQ
7>checked="checked"</cfif>
/>Farmers ⁄ Ranchers ⁄ Producers</label><br />
<label><input type="checkbox" id="business"
name="targetAudience" value="8" <cfif #qUpdateAudienceValues.taid# EQ
8>checked="checked"</cfif> />Business
Owners ⁄ Operators</label><br />
<label><input type="checkbox" id="scientists"
name="targetAudience" value="9" <cfif #qUpdateAudienceValues.taid# EQ
9>checked="checked"</cfif> />Scientists ⁄ Engineers</label><br
/>
</td>
I can get the first record to be checked from the "audienceValues" table by
matching the resource ID, which I have as the primary key and put into every
table, but I can't get the other values with the same resource ID to be
checked. I've tried query loops and index loops and cfsets with a ValueList()
function and am just running around in circles.
Any information or help is greatly appreciated.
Thanks.
Michael
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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-Newbie/message.cfm/messageid:2054
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15