Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

How to delete a cookie out of a list

Question posted by: ja5onkendall (Newbie) on March 17th, 2008 10:05 PM
I'm trying to create a save to fav's using CFCOOKIE.
The cookie is using a primary key from the database and adding on using ListAppend. I can't figure out how to delete a cookie out of the list.

Code: ( text )
  1. <cfquery name="savedJobs" datasource="#request.dsn#">
  2. SELECT *
  3. FROM tbJobs
  4. WHERE jobID IN
  5.  (
  6. <CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" LIST="Yes" SEPARATOR="," VALUE="#Cookie.save#">
  7.  )
  8. </cfquery>
  9. <!----------------------Set The Cookie---------------------------------------------->
  10.  
  11. <cfif isDefined("URL.toggle")>
  12. <cfcookie name="save" value="#jobID#" expires="30">
  13. </cfif>
  14.  
  15. <!---------------------Add A Cookie to the List------------------------------------->
  16. <cfset jobID = ListAppend(Cookie.save, #jobID#)>
  17.  
  18. <!-------Here is where I need help???---------------------------->
  19. <cfif isDefined("URL.delat")>
  20. <cfcookie name="save" value="#ListDeleteAt(cookie.save,listfind(cookie.save,job  ID))#" expires="now">
  21. </cfif>
Last edited by acoder : March 18th, 2008 at 01:26 PM. Reason: Added code tags
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
acoder's Avatar
acoder
Site Moderator
10,173 Posts
March 18th, 2008
02:28 PM
#2

Re: How to delete a cookie out of a list
If you set expires to "now", it will delete the whole cookie. Set expires to a date in the future.

Reply
Reply
Not the answer you were looking for? Post your question . . .
174,849 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Coldfusion Forum Contributors