Setting cookie upon successful form submission

Is there a way to set a cookie upon successful form submission of a popup? If so, how?

Please note, I would like for the cookie to be set on a successful form submission, not just any click on the submission button for a form.

Also, for my particular use case, I am not redirecting visitors to a confirmation page, so setting the cookie on a new page won’t work.

You can set a JavaScript cookie on the form confirmation window

https://www.w3schools.com/js/js_cookies.asp

Sorry, realized you said there isn’t a confirmation. Can you use onsubmit?
https://www.w3schools.com/tags/ev_onsubmit.asp

Or possibly test if an element is visible after the form is submitted?

Hey @Andy2,

You can set a cookie by pausing the form submit, setting the cookie and then releasing the form. This way only successful form submits would be “tagged”.

However, if you are using an Unbounce popup they are in an iFrame so you’ll run into issues retrieving the cookie afterwards.

Best,
Hristian