Hi Brendan. We ended up creating a custom webpart to collect Marketo form parameters and then writing the HTML, inserting it onto a page. The basic webpart itself was simple. However, we wanted to override the redirect and getting the correct URL on a multisite install was difficult. Next, we had to override the default Marketo styles (even if using "simple" form) to match the site theme/template which was accomplished using Bootstrap mixins and some hacky javascript (due to iframes) to strip Marketo classes from HTML tags. Its not the cleanest, but for what its worth, hope it helps.
WebPart
protected void SetupControl()
{
...
var divId = "formMarketo_" + FormId;
ltlPlaceholder.Text = "<div id=\"" + divId + "\" class=\"marketo-reset marketo-panel\" style=\"visibility: hidden;\"></div>";
ltlMarketo.Text = "<script src=\"//" + BaseUrl + "/js/forms2/js/forms2.min.js\"></script>";
StringBuilder builder = new StringBuilder(512);
builder.Append("MktoForms2.loadForm('//" + BaseUrl + "', '" + MunchkinId + "', " + FormId + ", function(form) {");
builder.Append("MktoForms2.$('#" + divId + "').append(form.getFormElem());");
builder.Append("form.onSuccess(function (values, followUpUrl) {");
// OnSuccess Calls
if (!string.IsNullOrEmpty(RedirectUrl))
{
var pageInfo = PageInfoProvider.GetPageInfo(CurrentSiteName, "", "", "", TreePathUtils.GetNodeIdByNodeGUID(new Guid(RedirectUrl), CurrentSiteName), true);
builder.Append("location.href = '" + pageInfo.AbsoluteURL + "'; return false;");
}
builder.Append("});");
builder.Append("});");
ltlScript.Text = ScriptHelper.GetScript(builder.ToString());
}
CSS
.marketo-reset button,
.marketo-reset input[type=button] {
.btn;
.btn-success;
}
JS
function marketoReset() {
// Remove All Classes / Styles
$('.marketo-reset .mktoForm').removeAttr("style");
$('.marketo-reset .mktoLabel').removeAttr("style");
$('.marketo-reset .mktoField').removeAttr("style");
$('.marketo-reset .mktoButtonWrap').removeAttr("style");
$('.marketo-reset .mktoForm').addClass("marketoForm");
$('.marketo-reset .mktoForm').removeClass("mktoForm");
// Set Visibility
$('.marketo-reset').css("visibility", "visible");
// Everything Ready - Send Message to Show Form
if ('parentIFrame' in window) window.parentIFrame.sendMessage('Ready'); return false;
}
$(".mktoForm").waitUntilExists(marketoReset);