[thelist] CF: CFCookie not sticking?

Frank lists at frankmarion.com
Thu Apr 29 20:46:08 CDT 2004


I've never had luck with CFCookie. This should be brain dead simple.

I've got an error checking fuse, and on an exception error, it presents a 
pretty error, with a simple form to permit the user to add additional 
comments, or to request a call.

When the user submit the form, it should simply fire it off and display a 
thank you note. Some errors, however, may be persistent, and not permit the 
following functions to occur (say a missing template).

In this case, I simply want to read a marker that this form has been 
submitted.  When the form is sent, I lay a cookie: error_submitted = 1.  If 
the same error re-occurs, the form first looks for the cookie's value.  If 
it equals 1, it displays a "thank but I can't do anything else" message 
instead of the form.

What is currently occurring is that the cookie does not appear to be 
laid.  IsDefined("cookie.error_submitted ") always EQ "NO".

Can anyone suggest where I might be missing the boat?


<cfif NOT IsDefined("cookie.error_submitted ")>

    <cfcookie name="error_submitted " value="1"
       expires="#CreateTimeSpan(0,0,30,0)#"
       domain="#cgi.server_name#"
       secure="Yes">

       <h1>An error has occurred.</h1>
       <form action="index.cfm" method="post">
        [... snip ...]

<cfelse>

    <cfcookie name="error_submitted "
       value="2"
       expires="#CreateTimeSpan(0,0,30,0)#"
       domain="#cgi.server_name#"
       secure="Yes">

       <h1>An error has occurred.</h1>
       <p>Ain't nuthin' to be done about it.</p>
        [... snip ...]

</cfif>


--
Frank Marion     lists at frankmarion.com      Keep the signal high.  



More information about the thelist mailing list