Quantcast
Channel: Topic Tag: contact-form | WordPress.org
Viewing all articles
Browse latest Browse all 5995

ancawonka on "Javascript for adding Cookies to a Contact Form"

$
0
0

Well, I came here to read and ask about cookies, too. I don't have the exact answer for you, but here are some things for you to try (if you haven't already).

0) Check to make sure that the contact form shortcode doesn't generate a totally different form than the one you're trying to post. Depending on which form tool you're using, there may already be a different JavaScript event that gets triggered on clicking the submit button.

1) Confirm that the cookie is set correctly. Using your browser's developer tools, you can view the cookies that have been set for that page (and their values). For example, in Safari, I can see cookies under the "Storage" tab of the developer tools. In Chrome, they are under "Resources->Cookies".

2) Note that if you use document.cookie, you are ONLY setting a cookie for that particular URL - so, if you have another page on the same domain you won't see the cookie. Take a look at this: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie

3) you might also consider putting all of the values in a single cookie (instead of creating a cookie for each field value).


Viewing all articles
Browse latest Browse all 5995

Trending Articles