Yes Michael, persistence is causing a problem.... I am setting the cookies
via _javascript_ with the following code....< see very below for how I'm
trying to delete them >. Just seems funny and odd, that a JS alert ( returns
different cookie values ). For example... the QUESTION cookie.. keeps coming
back....... I've also included code from my application.cfm page as well.

I'm starting to get frustrated... I may use session variables instead....
errrrgghhh.

The reason I'm setting them with JS as opposed to just coldfusion only, is
that I want the cookies to be stored after the user enters it into a form
field without the form being submitted. I need the data to be persistent in
my form. I thought of other ways to do this... such as having the JS call
another CF page ( which creates session variables. And then closing the page
right away ). But that seems dumb... the cookies should be working.

//  CODE TO SET THE COOKIES

function setdacookie(what, value, danum)
{
    if(what == "question")
    {
       document.cookie = "QUESTION=" + value ;
       alert(document.cookie);
    }
    else if(what == "question_o")
    {
if( eval("document.theform.optional.checked") == true )
{
             eval("document.theform.optional.checked = true"); value =
true; }
else
{
    eval("document.theform.optional.checked = false"); value = false; }

document.cookie = "OPTIONAL=" + value ;
    }

    else
    {
if(danum == 4)
                {
      if( eval("document.theform." + what + ".checked") == true )
      {
          eval("document.theform." + what + ".checked = true"); value =
true;
                       }
             else
      {
          eval("document.theform." + what + ".checked = false"); value =
false;       }
                }
document.cookie = what + "=" + value ;
      }

}

// APPLICATION.CFM CODE

<cfapplication name="surveyapp"
sessionmanagement="yes"
setclientcookies="yes"
sessiontimeout="#createtimespan(0, 0, 20, 0)#"
applicationtimeout="#createtimespan(0, 0, 20, 0)#"
clientmanagement="yes"
clientstorage="registry">

// CODE TO DELETE COOKIES

<cfcookie name="surveyid" value="" expires="now">
<cfcookie name="question" value="" expires="now">
<cfcookie name="optional" value="true" expires="now">

<cfloop from="1" to="20" index="i">
   <cfif isdefined('cookie.ans#i#') or isdefined('cookie.ans#i#check')>
        <cookie name="ans#i#" value="" expires="now">
        <cfcookie name="ans#i#check" value="" expires="now">
    </cfif>
</cfloop>

>Out of curiosity, is the persistence causing a problem for your code, or
>did you just notice that the output of this cookie was retaining these
>values after deleting them?  If there is no problem, I would say you are
>all set.  It would help to see a little more code though from the page
>where you are setting these variables.  Such as if you are using
>cfapplication and client management, how are you setting the cookies
>etc....
>
>
>   ----- Original Message -----
>   From: Dan Farmer
>   To: CF-Talk
>   Sent: Wednesday, December 03, 2003 12:13 PM
>   Subject: Re: question about cookies..
>
>
>   I've tried a CFDUMP var="#cookie#, and funny enough it returns a whole
>set
>   of different cookies than ( alert(document.cookie)) ....could it be tha
>to
>   need to use _javascript_ to delete them because they were created with
>   _javascript_? Someone mentioned that it might be because of page
>processing,
>   but no that's not it ( I've gone to subsequent pages and they are still
>   there ).
>
>   Here's my code trying to delete them ...
>
>   <cfcookie name="surveyid" value="" expires="now">
>   <cfcookie name="question" value="" expires="now">
>   <cfcookie name="optional" value="true" expires="now">
>
>   <cfloop from="1" to="20" index="i">
>
>   <cfif isdefined('cookie.ans#i#') or isdefined('cookie.ans#i#check')>
>   <cookie name="ans#i#" value="" expires="now">
>   <cfcookie name="ans#i#check" value="" expires="now">
>   </cfif>
>
>   </cfloop>
>
>   Here's what _javascript_: alert(document.cookie) returns >
>
>   question=What is my name macker; ans1sdfsdfs; ans1=Macker macker;
>   ans2=annaser er macka; optional=true; ans3=macker sdfsdf;
>ans1check=false;
>   ans2check=false; ans3check=false; ans4; ans4check=false;
>ans5check=false;
>   HIDEWELCOMEWINDOW=1; CFID=401; CFTOKEN=64042666;
>   JSESSIONID=7e301552641070328067800
>
>   Here's what CFDUMP returns >
>
>   ANS1 [empty string]
>   ANS1CHECK [empty string]
>   ANS2 [empty string]
>   ANS2CHECK [empty string]
>   ANS3 [empty string]
>   ANS3CHECK [empty string]
>   ANS4 [empty string]
>   ANS4CHECK [empty string]
>   ANS5 [empty string]
>   ANS5CHECK [empty string]
>   CFID 401
>   CFTOKEN 64042666
>   HIDEWELCOMEWINDOW 1
>   JSESSIONID 7e301552641070328067800
>   OPTIONAL true
>   QUESTION [empty string]
>   SURVEYID [empty string]
>   ans1sdfsdfs [undefined struct element]
>
>
>
>
>
>
>
>
>
>   >From: "Michael Hodgdon" <[EMAIL PROTECTED]>
>   >Reply-To: [EMAIL PROTECTED]
>   >To: CF-Talk <[EMAIL PROTECTED]>
>   >Subject: Re: question about cookies..
>   >Date: Wed, 3 Dec 2003 08:55:31 -0500
>   >MIME-Version: 1.0
>   >Received: from houseoffusion.com ([64.118.64.245]) by
>mc7-f40.hotmail.com
>   >with Microsoft SMTPSVC(5.0.2195.6713); Wed, 3 Dec 2003 05:57:59 -0800
>   >Received: from LOCALHOST by LOCALHOSTwith ESMTP id
>   >F1F7CA6331C19642BE3B1D7E27DC9432Wed, 3 Dec 2003 08:58:51 -0500
>   >X-Message-Info: JGTYoYF78jEUtpAfg9C5iCXZI2n429ql
>   >Message-ID: <[EMAIL PROTECTED]>
>   >Precedence: bulk
>   >References: <[EMAIL PROTECTED]>
>   >Return-Path: [EMAIL PROTECTED]
>   >X-OriginalArrivalTime: 03 Dec 2003 13:58:04.0283 (UTC)
>   >FILETIME=[78BBECB0:01C3B9A5]
>   >
>   >If you do a cfdump on the cookie scope (<cfdump var="#cookie#">), are
>the
>   >values still in there?  What does the code look like that is setting
>these
>   >cookies?
>   >
>   >
>   >   ----- Original Message -----
>   >   From: Dan Farmer
>   >   To: CF-Talk
>   >   Sent: Wednesday, December 03, 2003 1:59 AM
>   >   Subject: question about cookies..
>   >
>   >
>   >   I want to delete my cookie variables but they don't seem to be
>deleting.
>   >   What am I doing wrong in my code?  I originally set these cookies
>with
>   >   _javascript_, I don't see how that would make a difference..cookies
>are
>   >   cookies... anyway, when I do the JS alert statement below I get a
>whole
>   >ton
>   >   of cookies returned that should have been deleted.
>   >
>   >   <cfcookie name="surveyid" value="" expires="NOW">
>   >   <cfcookie name="question" value="" expires="NOW">
>   >   <cfcookie name="optional" value="" expires="NOW">
>   >
>   >   <cfloop from="1" to="20" index="i">
>   >
>   >   <cfcookie name="ans#i#" value="" expires="NOW">
>   >   <cfcookie name="ans#i#check" value="" expires="NOW">
>   >   </cfloop>
>   >
>   >   <script>
>   >
>   >   alert(document.cookie);
>   >
>   >   </script>
>   >
>   >   This JS code outputs the following...this is the cookie values...
>   >
>   >   question=What is my name macker; ans1sdfsdfs; ans1=Macker macker;
>   >   ans2=annaser er macka; optional=true; ans3=macker sdfsdf;
>   >ans1check=false;
>   >   ans2check=false; ans3check=false; ans4; ans4check=false;
>   >ans5check=false;
>   >   HIDEWELCOMEWINDOW=1; CFID=401; CFTOKEN=64042666;
>   >   JSESSIONID=7e301552641070328067800
>   >
>   >
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to