How can I skip a form that has been completed previously?

Hi everyone,

I’m a designer with limited code knowledge. I have a specific request to create a process whereby a Webinars page is accessed only once an email form has been submitted.

Currently, my plan for the user journey is:

  1. Click ‘Webinars’ page link from nav bar
  2. This takes you to a page (/Webinars-sign-up) with an email submission form and a full screen div that is blurring out the webinars page content
  3. On form submission, it redirects to the real Webinars page (/Webinars)

I want to find a way to do this where the user doesn’t have to fill out this form every time they come back to the page. Therefore, if a user has already submitted the form in step 2, they can skip straight to the Webinars page.

I’m really just looking for general help, thoughts and ideas on how I can make this dream a reality in the most simple way possible, as I have very little code understanding beyond basic html/css.

Thanks in advance!

Just to update this post, I found a few pieces of code (one to check for cookies and one to complete an action on form submit) that I merged into this:

<script>
var cookieName = 'webinarsSubmit';
if(typeof Cookies.get(cookieName) !== 'undefined') {
$('.formWrap').remove();
}
$('.webinarsForm').submit(()=>{
Cookies.set(cookieName, 'ok', { expires: 365 });
})
</script>

Can anyone help validate this code for me?

Hey Molly, can’t guarantee this will work instantly but I made some edits to your code. You can try it on your site to validate if it works.

<script>
var cookieName = 'webinarsSubmit';
if(typeof Cookies.get(cookieName) !== 'undefined') {
window.location.replace("http://yoursite.com/webinar"); //Edited this to redirect if cookie is found
}
$('.webinarsForm').submit()=>{ //Edited this line because there was extra '('
Cookies.set(cookieName, 'ok', { expires: 365 });
alert('Cookie set', Cookies.get('cookieName')) //  Just to check if your code works. You can remove this later. Shows an alert when webinarform is submitted.
})
</script>

Thanks so much! I’ll give it a go on Monday and let you know how I get on.

1 Like

Hi Molly

Very similar situation over here. Did you ever find a solution for this? Did the above code work?