Hi,
I am creating a GDPR consent block with CS Forms. I tried to add a cookie ‘SET’ action on form submission but it returned an error. Probably due to there being no data submitted upon clicking the submit button only. I added a hidden input field, which sets the cookie. Now I see the cookie added in the browser, and the error has disappeared. Is that the right way to do it?
Another problem is that when I open a page for the first time, the cookie notice appears as it should. But the cookie is SET in the background even though I don’t click the button in the consent block. As a result, the block disappears upon reloading the page. If I check the page with the dev tools and delete the cookie from Application, it happens again. There is no block on second reload
Maybe CF Form is not the best way to set a cookie. When the page reloads, it shows a message about sending the same form data again. However, with AJAX, this is probably not the case. If we use a regular Button Element, how do we make it SET a cookie only on click and not on page load?
What do I do wrong?