close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

storing entire form in cookie for 1 day not clearing itself

Thread began 1/20/2010 1:14 pm by neileisen207079 | Last modified 2/01/2010 6:19 pm by Eric Mittman | 2461 views | 6 replies |

neileisen207079

storing entire form in cookie for 1 day not clearing itself

I have the store entire form in cookie behavior working and it works fine. I have it set to save for 1 day. The only problem is a week later all the info is still there. I did a work around by having the cookie cleared on the load of the home page, but it should work, right?

Also I would rather have it cleared when the browser is closed.

This is the form submit code:
<form action="confirmquote.php" method="post" enctype="multipart/form-data" name="specialorder" id="specialorder" onsubmit="WA_setFormCookie(WA_CookieObj,document.specialorder,'WAFC_details_specialorder', 1);WA_setCookie(WA_CookieObj,'instructions',document.specialorder.instructions.value,true,0,1)">


This is in the head:

function WA_setCookie(cookieobj, cookiename, cookievalue, cookiecheck, settype, expdays) {
var theValue = "";
if (settype == 1) {
for (var n=0; n<cookievalue.length; n++) {
if (cookievalue[n].checked) {
theValue = cookievalue[n].value;
}
}
}
else if (settype == 2) {
for (var n=0; n<cookievalue.options.length; n++) {
if (cookievalue.options[n].selected) {
if (theValue != "")
theValue += ", ";
theValue += cookievalue.options[n].value;
}
}
}
else {
theValue = cookievalue
}

if (cookiecheck) {
if (expdays) {
cookieobj.expires = daysToExpire(expdays);
}
else {
cookieobj.expires = "";
}
cookieobj.setValue(cookiename, theValue, expdays);
}
}
</script>

Sign in to reply to this post

Eric Mittman

Looking at the code you have to set the cookie it seems that it should be set to expire in one day. You can check this out by viewing the cookie in FireFox. You do this by going to Tools > Options > Privacy > remove individual cookies.

In here find the domain your cookie is coming from and locate the cookie. When you select the cookie you should be able to see all of it's attributes including the expiration date.

If you would like the cookie to end with the session you should try leaving the expiration days blank. If there is no value specified it should exist only during the session. Please post back and let us know what you discover.

Sign in to reply to this post

neileisen207079

Still not working

OK, I checked in Firefox and in Safari and both show the same thing. Even though the code is set to expire in 1 day ( it shows the numer 1 in the code) it sets itself for 1 month.

I tried leaving it blank, and it stopped working. I tried making it 0 and it still set it for 1 month.

Sign in to reply to this post

neileisen207079

PS

I also added it to a totally different form on a different page and it also does the same thing. No matter what I put it expires in a month.

Sign in to reply to this post

Eric Mittman

Can you post back with your new sample test page that is also expiring in a month. When I'm testing this out the cookie is set to expire the next day when I set it to 1. It does not seem to matter what browser I'm using. I would like to do some testing with your cookie if I can.

Sign in to reply to this post

neileisen207079

Simple form set to 1 day still expires in 30

I decided to make a test form with one field and set the cookie to expire in 1 day. I tried it today, January 30th and the cookie it set in Firefox shows it expires on March 1, which is 30 days from now.

Whats wrong?

Thanks.... file attached.

Attached Files
cookie.zip
Sign in to reply to this post

Eric Mittman

What is the version of Cookies Toolkit that you are working with? It seems that you have an older versions code on the page that is not taking into account the expiration days. You should update the function on this page on lines 7-13 with this:

<script type="text/javascript">
<!--
function WA_setFormCookie(cookieObj, formObj, cookieName, expdays) {
if (expdays) {
cookieObj.expires = daysToExpire(expdays);
}
else {
cookieObj.expires = "";
}
cookieFormToString(cookieObj,formObj,cookieName);
}
//-->
</script>



This should not be an issue in the latest release of the cookies toolkit which is 3.1.2 at the time of this post.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...