You're trying to capture a user's email from one form submission and later pre-fill another form field with that same email on a different page or step. If the script you're using shows "undefined", it likely means the email is not being properly stored or retrieved.
In the Page Settings or using an Embed element on the same page as the first form, insert custom JavaScript to store the email after they submit.
Use the localStorage
API to save the email address.
Here's a simplified version that works with Webflow forms:
Place this in the Footer section of your page settings (or an Embed block):
```javascript
```
Important: Make sure your form has an email input of type="email"
.
On the sign-up form page, insert a script to retrieve the email from localStorage
and set it into the right field.
Again, place this in the Footer section or Embed element:
```javascript
```
Match the input name: If the second form's email field has a different name attribute (e.g., name="user_email"
), update querySelector
accordingly.
Check if the first form actually runs the script. You might be saving undefined
if the script runs before the form is filled out.
Ensure the first form has submitted before testing the second page.
If using Webflow's interactions instead of a default form submission, the event listener may not fire. Use "w-form-done"
in that case:
```javascript
$('.w-form-done').on('DOMSubtreeModified', function () {
const email = document.querySelector('input[type="email"]').value;
localStorage.setItem("savedEmail", email);
});
```
To pass an email from one Webflow form to another:
localStorage
after the first form submission using a script.