PDA

View Full Version : Help required using javascript cookies


skinnybloke
28-Feb-2003, 09:51 AM
Hi - this is a question regarding javascript cookies.

I am using a javascript script to pass choices from 3 drop down
boxes within a search form, to the same form on other pages. This saves users having to scroll down the contents of the 3 boxes when they only want to change one option.

I am doing this by writing and reading from a session-only cookie.

The search form is on all the pages on my site.

The search form can be run from pages in 3 directories all unbder the same domain name - the root directory, the acatalog directory and the search results page which shows the cgi-bin in the url.

The problem I have is that the drop down box entries are not passed between the screens in the different directories.

If I enter choices in the acatalog screen, they are not displayed in the drop down boxes on the cgi-bin screens. If I then enter choices in the cgi-bin screen they are picked up by every other cgi-bin screen. When I go back to the acatalog screen the choices shown are the ones I entered last time I was in the acatalog screen.

The site is hosted on a Linux/Apache server.

Any help would be appreciated.

skinnybloke
28-Feb-2003, 10:30 AM
...a bit more information on this. I have been looking at the document.cookie and this is what it shows:

1. I lstart browser and load the site index page - document cookie displays:

CART_CONTENT=CART_TOTAL%09%a30%2e00%09CART_COUNT%090%0a;
ACTINIC_CART=cacheZknoZhsiZcableinetZcoZukA1046426010B31691

2. I enter Buff, menswear and accessories as search choices.

Actinic search results page shows:

CART_CONTENT=CART_TOTAL%09%a30%2e00%09CART_COUNT%090%0a;
ACTINIC_CART=cacheZknoZhsiZcableinetZcoZukA1046426010B31691; cookiebrand=buff;
cookiecategory=menswear; cookieproduct=accessories;
domain=http://www.mysite.com; path=/; ACTINIC_BUSINESS=-

3. I enter Jack Murphy, womenswear, jackets

Actinic search results page shows:

cookiebrand=jackmurphy; cookiecategory=womenswear; cookieproduct=jackets;
domain=http://www.mysite.com; path=/;
CART_CONTENT=CART_TOTAL%09%a30%2e00%09CART_COUNT%090%0a;
ACTINIC_CART=cacheZknoZhsiZcableinetZcoZukA1046426010B31691; cookiebrand=buff;
cookiecategory=menswear; cookieproduct=accessories;
domain=http://www.mysite.com; path=/; ACTINIC_BUSINESS=-

I then go back to the index page and the cookie details change back to:

CART_CONTENT=CART_TOTAL%09%a30%2e00%09CART_COUNT%090%0a;
ACTINIC_CART=cacheZknoZhsiZcableinetZcoZukA1046426010B31691; cookiebrand=buff;
cookiecategory=menswear; cookieproduct=accessories;
domain=http://www.mysite.com; path=/; ACTINIC_BUSINESS=- B31691

cdicken
03-Mar-2003, 09:40 AM
Hmm, my only suggestion would be to find a way to wipe all search drop-down cookie information if a customer enters new search terms. It seems as if any new information is added to the cookie, rather than replacing the existing search drop-down cookie information. This could be where the browser is getting confused.

skinnybloke
04-Mar-2003, 05:47 PM
Hi Chris - I managed to sort this out. I had omiited to put a "path=/ parameter" when I set the cookie...sorted!!