Using forms 2.0 and loading multiple forms on some of the pages. Sometimes one of the forms loads and it doesn't have formid and munchkinId populated. Has anyone seen this?
It does not happen 100% of the time. Tried different computers, browsers, incognito windows etc, sometimes the fields are populated, sometimes they are not.
Have a temporary workaround where I just swing back with some javascript to populate these fields but this should not be happening.
Solved! Go to Solution.
Have you looked into this code in is-mkto.min.js?
var blockedForms = ["mktoForm_1688", "mktoForm_1182"];
for (var a = 0, i = blockedForms.length; i > a; a++)
$("#" + blockedForms[a] + " input").val("")
This code specifically clears fields, including hidden fields, and does not appear to be using the Marketo Forms 2.0 event model (i.e. it may have a race condition). One of those two forms (1182) is on your page.
Hi Charles,
Are you doing this on Marketo hosted landing pages or non-Marketo pages? Since Marketo forms interact in a special way with Marketo pages, last I knew it wasn't supported to use multiple marketo forms on the same marketo page by using the embed code in an HTML block or hard-coding it into the template. That may have changed, but I know it used to run into problems.
Grant
Doing this on our site. We have a footer form that is on every page. So some form pages end up with 2 forms on the page.
Not using embed code or hardcoding the forms, but using the 2.0 code, the form that is rendered is drawn directly from Marketo.
Please provide a URL where you can -- at least after a human-capable number of tries -- reproduce this. I haven't dealt with this but It's easy to imagine a situation in which it could happen if you're talking about the same form ID on multiple times on the same page.
AFAIK the formid is actually read from the form descriptor, while the munchkinId is taken directly from the argument to loadForm. Also note the Forms 2.0 library has been at the same rev for 2 weeks.
Hi Sanford,
I have a url, but I have my workaround is running on it so you will not be able to see the behavior. https://www.infusionsoft.com/refer
Can't duplicate this in isolated instances, where I put two forms on a page and that's it, no extra scripts or mumbo jumbo, just the 2 forms.
Note that It could be one of our scripts that is actually removing the values, but nothing we wrote is targeting those fields.
The forms load async so I can't put dom or javascript breakpoints in to see what's really happening.
Was wondering if anyone ran across it to more narrow down the issue, is it multi Marketo 2.0 forms or conflicting scripts on our end?
Thanks
I have a url, but I have my workaround is running on it so you will not be able to see the behavior. https://www.infusionsoft.com/refer
Can you please put up a repro URL so I can help you?
The forms load async so I can't put dom or javascript breakpoints in to see what's really happening.
Sure y'can. I do it all the time.
Have you looked into this code in is-mkto.min.js?
var blockedForms = ["mktoForm_1688", "mktoForm_1182"];
for (var a = 0, i = blockedForms.length; i > a; a++)
$("#" + blockedForms[a] + " input").val("")
This code specifically clears fields, including hidden fields, and does not appear to be using the Marketo Forms 2.0 event model (i.e. it may have a race condition). One of those two forms (1182) is on your page.
Sanford, you've done it again!
That's gotta be the problem. Those are the 2 forms that were having issues.
We auto fill the forms and that script is meant to keep the auto fill from filling in the fields since we don't want the customer's info on them. I don't think whomever wrote that piece thought about the hidden inputs being erased.
Happy to help. That code should be wrapped in
MktoForms2.whenReady(function(form){ ... })
because otherwise (even if you exclude the hidden fields) the run order isn't guaranteed.
You can disable prefill on specific fields in the form editor. There's no need to do that with custom code.