We're in the process of implementing Marketo, but we can’t get the forms to work with our CMS (Kentico).
It just does not show up (test URL: https://www.bdo.dk/da-dk/services/moms/told/test-3 ). I have a suspicion that it is because the Marketo form becomes nested, but I’m not sure.
Has anyone had any luck with using Marketo forms in Kentico and if so, how did you make it work? And is it a problem with the CMS that can be fixed by developers?
It doesn't look like you have an HTML container for the form to live in. You need to add this line:
In Marketo you can pull the embed code which would give you something like this:
It doesn't look like you have an HTML container for the form to live in.
Not exactly (unless the page has changed since you posted). The <form> element does exist in the initial HTML.
However, it’s inside another form, which is not allowed, so it will not be rendered.
There’s a giant form that wraps the entire body:
Thank you both - much appreciated.
@SanfordWhiteman , your explanation is what I suspected. Any ideas to solving it (other than changing CMS)?
Only thing that comes to mind is moving the Marketo <form> outside the big Kentico <form> using JS so it’ll render, then absolute-positioning it in the place you want.
I got it to work with a script like the one below (just in case someone finds this in a Google search).
Hmm, that‘s still a <form> inside a <form>, which isn’t allowed.
I would be exceedingly wary of rolling that out without extensive testing in all possible browsers & combinations of form names & values, since each browser can make its own choice about what to do with a non-standard structure like this — including not posting one of the forms at all — and if they all made the same choice, that could still break things.
For example, take this markup:
<form id="form1"> <input type="text" name="input1" value="value 1.1"> <input type="text" name="input2" value="value 2"> <input type="submit" name="submit" value="outerform"> <form id="form2"> <input type="text" name="input1" value="value 1.2"> <input type="text" name="input3" value="value 3"> <input type="submit" name="submit" value="innerform"> </form> ⋖/form>
What do you think is posted to the server for the field input1 if you click the submit button with the value innerform?
The answer, in latest Chrome and Firefox for desktop, is both values are sent:
Hopefully you can see why that can be problematic!