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




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218375
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to