PDA

View Full Version : Form Saver Cookie


NymRod
02-07-2003, 05:37 PM
Howdy

I'm using this cookie script to save form values in multiple forms so the info won't need to be re-entered each time it's opened.
http://javascript.internet.com/forms/cookie-form-saver.html#source

It works fine on multiple HTML pages contained in the same folder on my hd, it will save the values for each of the form pages.

When I compile the HTML pages into an ebook it will only remember the form values from the last form used and wipes out all previous forms values entered in the other forms.

I think the solution would be to rename the cookie used on each page so each page had a different cookie, i.e. edit this line in the cookie,
var endstr = document.cookie.indexOf (";", offset);

I think the problem is the " indexOf " part of that line,
the HTML pages are each their own separate documents with different file names while the ebook is compiled into a single .exe file.

I've tried editing that line a few different ways but still get the same results, it only saves the last form values used.

Any ideas on how to get it to write a cookie for each form used in the ebook?

Thanks

NymRod

NymRod
02-07-2003, 07:55 PM
I figured it out.

I had to code the cookies for each form,

if (document.form1.saveme.checked) {cookieValue = cookieValue + passValue + '#cf#';}

for form1 and

if (document.form2.saveme.checked) {cookieValue = cookieValue + passValue + '#cf#';}

for form2 and named each form to use with separate cookies.

Now it writes a cookie for each form.


NymRod