![]() |
help with setting/reading/getting cookies
I don't expect someone to do my classwork for me! I would like some help because I don't know where i'm going wrong.This code has been adapted from my previous weeks homework and what it is supposed to do is: Modify the prototype form page so that when the Javascript function has verified that all of the required fields have been filled, a cookie is added to the user's computer. If the same user attempts to fill out the form a second time, the user will be directed to a separate HTML page advising them that they have already submitted the form.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
Code:
<meta content="en-us" http-equiv="Content-Language" >You also need to enclose your code in [CODE ] and [ /CODE] tags (without spaces). Having said all this, you haven't asked a question, or described the error or issue that you are having ?? |
The problem I am having is (1)when a user clicks submit, there is no cookie set.
(2)Since there is no cookie set, there is no redirection to either a confirmation page labeled acknowledgement.html that would state the users info has been collected or to a page labeled error.html which would tell the user that the information has already been submitted. |
You have an unmatched bracket:
Code:
//this function checks flag and redirects accordinglyPlease edit your OP to wrap the code in [ CODE ] tags. |
I suggest you start by fixing the errors indicated in the console.
|
Quote:
|
Quote:
|
Well thanks to my online teacher, I still haven't recieved a markup for my code even tthough I submiteed it Sunday. But anyway I revised my code and I think I am almost there but I wonder if I am using an undeclared variable or if I incorrectly initiated a function. for some reason the cookie is not being set/read to redirect users to an error page. I am trying to set the cookie value with a persons email address since that is a unique identifier. Thank You in advance for anyones help in pointing out my errors! Here is the code:
Code:
//<!-- Begin |
Which browser are you using? Google Chrome restricts the setting of cookies locally (or it certainly used to..), although this can be unset with a command-line argument.
Try different browsers. Andy. Command-line for Chrome: chrome --allow-file-access-from-files |
Quote:
It doesn't matter which browser I use, I just can't seem to get the desired effect which is to set a cookie(emailaddress as the value), get the cookie,read the cookie to compare the value(email address) and then either let the person submit the form OR then propmpt the user thier info has already been submitted and then redirect the user to an error page. |
You should remove the spaces you have between your functions calls:
Code:
new Date ();[I haven't looked at your cookie code.] |
You should learn to use a console and alert's to debug your code.
|
Thank you guys for all your input, you are sure helping better than my flipping teacher.
|
| All times are GMT +1. The time now is 06:06 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.