Skip to main content
Inspiring
December 14, 2007
Question

check boxes and deleting items in a query

  • December 14, 2007
  • 2 replies
  • 406 views
I have a query where I would like to allow checking off checkboxes next to items in the query to be deleted instead of checking them one by one.

<cfoutput query name="somequery">
<form>

del<input type ="checkbox" value ="#v#">Item one
del<input type ="checkbox" value ="#v#">Item two
del<input type ="checkbox" value ="#v#">Item three

check all
</form


</cfoutput>
    This topic has been closed for replies.

    2 replies

    December 14, 2007
    Jenn, if it's not to late think about just "deactivating" your items. I usually have a Bit field (or yes/no) that is "off" for deleted, I also have a Bit field for Active. I'm just someone who hates actually deleting info from a db and then realizing "hey that wasn't a good idea".

    There may be a security problem with allowing someone sending a list of IDs to delete from your table as well. If this is an internal website it probably wouldn't be as big of a concern.

    Inspiring
    December 14, 2007
    Give each checkbox the same name. Values of the checked checkboxes when posted to your processing page will be in a comma delimited list.

    Your SQL should then look like this:
    Delete from MyTable where UniqueID in (#form.myCheckBox#)