If the form elements look like:
<form data-formid="2387" data-formname="Top Form"></form>
<form data-formid="2387" data-formname="Bottom Form"></form>
Then you can switch based on the ID and any distinguishing attributes:
MktoForms2.whenReady(function(mktoForm){
var formId = mktoForm.getId(),
formEl = mktoForm.getFormElem()[0],
formName = formEl.getAttribute("data-formname");
mktoForm.onSuccess(function(submittedValues,thankYouURL){
if (formId == 2387 && formName == "Top Form") {
// do whatever
}
if (formId == 2387 && formName == "Bottom Form") {
// do whatever else
}
});
});
... View more