Using LocalStorage to support a pop-up modal form on next page

Hello all!

First post and it’s a doozy… Been trying to figure this out for awhile and it may just be a Zapier limitation.

I’ve created a regular Landing page and Thank-you page for a Webinar Opt-in sequence. I’m currently capturing the Email and First Name on the Opt-in page and then wanting to capture the Phone Number inside a pop-up modal on the Thank-you page.

I’m currently using Zapier to handle the data passing to my CRM. And for Zapier, you MUST provide a Email to “Check for Duplicates”. Is there a way you can pass Zapier the email via LocalStorage?

As there is only one input (the phone number) I’m not able to pass the email within the form submission to check for duplicates… Has anyone run into this?

I’m currently passing a new FormData object with both “email” and “phone number” in the object and Zapier is still not detecting. Here is the code that IS WORKING.

After typing this out, maybe this is a question for a Zapier forum? Not sure… anything helps!

<script>
	// page load
  const formElem = document.querySelector('form');
  const storedEmail = localStorage.getItem('email');
  const popup = document.querySelector('.popup');
  const phone = document.querySelector('#phone-number');
  
  console.log(storedEmail);
  
  formElem.addEventListener('submit', submitPhone);
  
  function submitPhone(e) {
    const formData = new FormData(formElem);
    formData.append('email', storedEmail);
		for (var value of formData.values()) {
    	console.log(value);
    }
	}
  
 	document.addEventListener('DOMContentLoaded', activatePopup);
  
  function activatePopup() {
		setTimeout(() => {
    	popup.classList.add('active');
    }, 2500);
  }
</script>

But that code is effectively not working, on the submit event you are just creating a new FormData, but you are not sending that form data as form content. Creating a new FormData doesn’t modify the original form data that get’s sent. You have 2 ways:

  1. Stop the default event and send the formdata on your own using fetch api (not adviced)
  2. Totally skip the submit event and just append and input of type hidden with the email inside to the form (better solution)

Thank you for teaching me a bit on the FormData object and Forms in JS. Definitely wanting to learn more but I had a feeling the using a fetch would just be too convoluted for the solution im needing.

As for the #2 solution, thats what I was thinking… as for implementing that, I would still be using Webflow form block, but just adding a custom input (using an embed?) and have the type atr=“hidden”?

Going to try it! Sounds cool and I’ve never used hidden inputs, but sounds interesting.