You have an ID field for every single record. So yes, it's hitting them all
in your action query when you loop over that field. Give your
delete_noticeboard" field a value of the NoticeBoardID inside your loop.
On your form, change
<input name="delete_noticeboard" type="checkbox" value="Yes">
To
<input name="delete_noticeboard" type="checkbox" value="#NoticeBoardID#">
At the top of your update query page, add this to ensure no error is thrown
when no boxes were checked
<cfparam name="form.delete_noticeboard" default="">
And in your loop, change
list="#form.ID#"
to
list="#form.delete_noticeboard#"
When you submit the form now, the #Form.delete_noticeboard# will hold a
comma delimited list of all of the selected check box values. (A comma
delimited list of all the NoticeIDs you want to delete)
Good luck.
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-----Original Message-----
From: Mark Henderson [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 15, 2005 12:00 AM
To: CF-Talk
Subject: Another radio button problem
I am having issues with a form that allows multiple deletes (or in this
case simply changing the active db field to no) from a database using
checkboxes.
Hers the deal so far. The query to display all noticeboard items is...
<cfquery name = "qryNoticeboard" datasource = "#request.dsn#">
SELECT noticeboardID,
title,
description,
dateAdded,
userInitials,
active
FROM noticeBoard
WHERE active = Yes
ORDER BY dateAdded DESC
</cfquery>
In the display, I have..
<form method="post"
action="<cfoutput>#myself##xfa.processNoticeboardDeletion#</cfoutput>"
id="deleteNoticeboardItem">
<cfoutput query="qryNoticeboard">
<div class="noticeboard">
<span class="title">#dateformat(dateAdded, "d/mm/yyyy")# -
#timeformat(dateAdded, "hh:mm tt")# :</span>
<strong>#title#</strong><br />
#description#
<cfif Len(userInitials)><span
class="user-initials">[#userInitials#]</span></cfif>
<br />
<div class="genericform">
<input type="hidden" name="ID" value="#noticeboardID#" />
<input type="hidden" name="boardCount"
value="#qryNoticeboard.recordCount#" />
<input name="delete_noticeboard" type="checkbox" value="Yes" />
</div>
</div>
</cfoutput>
<input type="submit" name="Submit" value="delete item" class="btn-gray"
/>
</form>
And the processing (which I am pretty sure where my logic is screwed).
Ive tried
<cfloop list="#form.ID#" index="listItem">
<cfquery datasource = "#request.dsn#" name = "qryDeleteNoticeboardItem">
UPDATE noticeBoard
SET active = No
WHERE noticeboardID = #listItem#
</cfquery>
</cfloop>
But naturally this turns off ALL records, because it seems all IDs are
being passed into form.ID. I need a way to pass only the IDs that are
ticked in the display. Any ideas?
Please help! All help greatly appreciated.
regards
Mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218398
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54