SanfordWhiteman
Level 10 - Community Moderator

Re: Do you understand the difference between different Marketo form parameters?

Almost all the JS here is wrong and/or unnecessary, Sant.

  1. You do not need to forward the Email value from one form to another unless you know that cookies are not enabled -- which cannot be the case here, since you're using a cookie to forward the value!
  2. Even if you needed to save data to a cookie, you don't do it based on DOM events, you use the Marketo Forms 2.0 JS API event model (the onValidate event in particular).
  3. You do not need to manually restore the value from the cookie. The whole idea of filling a form field from a cookie is that it happens automatically.  Of course, as noted above, you do not need the cookie at all.
  4. Waiting for DOMContentLoaded doesn't make sense because this doesn't mean the Marketo form is ready (assuming you were trying to populate the hidden Marketo field from the cookie). Again, you would use the Marketo Forms 2.0 JS API, but none of this is necessary.

Please, you must test your code thoroughly before posting it. If you're not comfortable enough with the technical environment (DOM events, Marketo events, etc.) to test your code, that's a sign that it shouldn't be published. For now, the JS in this post should be removed.