Okay, so in the body of my HTML, I have a form like this:
<form action="http://customers.tryloom.io/index.php/leadCapture/save" class="form-horizontal lpeRegForm formNotEmpty form-inline" enctype="application/x-www-form-urlencoded" id="mktForm_1024" method="post" name="mktForm_1024">
<div class="form-group first-name">
<div class="mktFormReq mktField"><label class="col-sm-2 control-label"></label><span class=
"mktInput col-sm-10"><input class="form-control mktFormText mktFormString mktFReq" id="FirstName"
maxlength="255" name="FirstName" tabindex="1" type="text" value="" placeholder="First Name"><span class="mktFormMsg"></span></span></div>
</div>
<div class="form-group last-name">
<div class="mktFormReq mktField"><label class="col-sm-2 control-label"></label><span class=
"mktInput col-sm-10"><input class="form-control mktFormText mktFormString mktFReq" id="LastName"
maxlength="255" name="LastName" tabindex="2" type="text" value="" placeholder="Last Name"><span class="mktFormMsg"></span></span></div>
</div>
<div class="form-group">
<div class="mktField mktFormReq"><label class="col-sm-2 control-label"></label><span class="mktInput col-sm-10"><input class="form-control mktFormText mktFormEmail mktFReq" id="Email" maxlength="255" name="Email" tabindex="5" type="email" value="" placeholder="Email Address" required><span class="mktFormMsg"></span></span></div>
</div>
<div id="mktFrmButtons">
<label> </label>
<div class="buttonSubmit">
<a onclick='formSubmit(document.getElementById("mktForm_1024")); return false;' href="#" class="button">SUBMIT</a>
</div>
</div>
<span style="display:none;">
<input name="_marketo_comments" type="text" value="">
</span>
<input name="lpId" type="hidden" value="1111">
<input name="subId" type="hidden" value="117">
<input name="munchkinId" type="hidden" value="882-OYR-915">
<input name="kw" type="hidden" value="">
<input name="cr" type="hidden" value="">
<input name="searchstr" type="hidden" value="">
<input name="lpurl" type="hidden" value="http://customers.mysite.com/ContactSalesWeb_test.html?cr={creative}&kw={keyword}">
<input name="formid" type="hidden" value="1024">
<input name="returnURL" type="hidden" value="www.mysite.io">
<input name="retURL" type="hidden" value="www.mysite.io">
<input name="returnLPId" type="hidden" value="-1">
<input name="_mkt_disp" type="hidden" value="return">
<input name="_mkt_trk" type="hidden" value="http://customers.mysite.com/test.html?cr={creative}&kw={keyword}">
</form>
And then, at the bottom, I have the new JS:
<script src="//app-sj01.marketo.com/js/forms2/js/forms2.js"></script>
<form id="mktoForm_1024"></form>
<script type="text/javascript">
MktoForms2.loadForm("//app-sj01.marketo.com", "882-OYR-915", 1024, function(form) {
form.onSuccess(function(values, followUpUrl){
form.getFormElem().hide();
return false;
});
});
</script>
But then there's also this JavaScript still being used...
<script type="text/javascript">
function formSubmit(elt) {
var formSubmit = Mkto.formSubmit(elt);
if (!formSubmit) {
jQuery('span.mktFormSubmitError').show();
return false;
}
return true;
}
function formReset(elt) {
return Mkto.formReset(elt);
}
</script>
Sorry for including all the code, but thought it would be faster to include it 🙂