Email conversation
From | Bart Oppeel |
To | Me |
Subject | Script 'Save Form Values' + 'cookie handling' problem |
Date | 4 January 2009 05:44 |
Hi Mr. Wilton-Jones,
I've been juggling around with these scripts for a while now and I
just can't seem to get them to work.
1. Combining 'Save Form Values' and 'Cookie handling' scripts
2. The original website was : [URL], now I have downloaded
and edited the checklist for offline/local use, which I have attached
as a rar-file.
3. I simply want it to remember which checkboxes I have checked, the
next time I load the page/start my browser.
4. Anything I tried ends up in the checkboxes staying blank, I
probably am just missing something in the script or with the cookie
names, or that's what I'm thinking.
5. 2 times 'Invalid character' and 1 time 'object expected'. in IE 7.0.5730
In Firefox 3.0.5 and Opera 9.63 I don't see anything mentioning an
error, but I imagine it would be the same as IE.
I would prefer to have this working on the local webpage I attached,
but aslong as I have one way or another to keep those checkboxes from
clearing up I'll be happy.
Hoping you can help and Thanks in advance.
--
Greetz,
--=={BobMaster}==--
From | Me |
To | Bart Oppeel |
Subject | Re: Script 'Save Form Values' + 'cookie handling' problem |
Date | 10 January 2009 07:34 |
Bart,
> Anything I tried ends up in the checkboxes staying blank, I
> probably am just missing something in the script or with the cookie
> names, or that's what I'm thinking.
You have copied sample code directly from my documentation, without
changing it to suit your own page. You are using this:
document.forms.myForm
But your form is not called "myForm":
<form>
If it were done like this, it would work:
<form name="myForm">
You're also calling the save and recovery code twice:
recoverInputs(...);recoverInputs(...);
Instead of just once:
recoverInputs(...);
This won't affect the result, but it is pointless.
Note that if your page gets much longer, you will run into the cookie
length limitation, though it should work at the moment. Note also that
by default, IE will not run scripts on pages loaded from the local disk.
This may or may not be a problem for you, of course.
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Bart Oppeel |
To | Me |
Subject | Re: Script 'Save Form Values' + 'cookie handling' problem |
Date | 11 January 2009 08:04 |
Mr. Wiltin-Jones,
Thank you for the reply, that did the trick, silly me :p
Only problem after that was making the cookie permanent. First managed
to make it last for 360 days, and now am using '[brand]' to
protect it. If you know any other/better way to do this, I'll be happy
to hear it.
In any case, a big thanks for helpig me in your own free time.
From | Me |
To | Bart Oppeel |
Subject | Re: Script 'Save Form Values' + 'cookie handling' problem |
Date | 18 January 2009 09:11 |
Bart,
> Only problem after that was making the cookie permanent. First managed
> to make it last for 360 days.
> If you know any other/better way to do this, I'll be happy to hear it.
There is no better way to do this (except set cookie lifetime to 10
years - about 315360000 seconds - I doubt you would ever need a cookie
to last that long, would you?). By design, Web pages are not allowed to
store permanent cookies. That's an intentional restriction in the cookie
spec.