Hi Sanford,
Doesn't the "wenReady" method help on this ?
-Greg
Doesn't the "wenReady" method help on this ?
As you probably already figured, nope.
You've got two processes running both automatically and asychronously that usually have a human factor "guaranteeing" enough breathing room.
Hi again Sanford,
Since the issue is when the munchkin code is executed, would it make sense to use a free form template without the default Marketo code and add to it the synchronous/simple munchkin followed by a small JS that sends the lead to the SM page when it's completed ?
-Greg
Since the issue is when the munchkin code is executed, would it make sense to use a free form with a template without the default Marketo code that adds the synchronous munchkin followed by a small JS that sends the lead to the SM page when it's completed ?
Yes, it would.
This whole process really needs to be either synchronous or tightly-managed-async or it's going to screw up.
P.S. You are going to Summit next year, I hope? I feel there are so many late-night geek sessions waiting to happen...
Hi again Sanford,
I am not sure I'll have time. I am running a small shop during the day and it's really hard to be away almost a week (including travel time).
-Greg
Hi,
The value 999-xxx-999 is this referring to the munchkin code. Also The second part of the JS is this right for the re-direct?
MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
// Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
location.href = "https://www.surveymonkey.com/r/5KQ3VGB";
// Return false to prevent the submission handler continuing with its own processing
return false;
});
});
</script>
I answered my own question. Its the Munchkin code.
I just need to figure out the redirect.
Here is the code
<script src="//app-ab02.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_2190" style="display:none"></form>
<script>
MktoForms2.loadForm("//app-ab02.marketo.com", 663-HBN-994", 2190, function(form) {
MktoForms2.whenReady(function (form) {
form.submit();
});
});
</script>
You already had the redirection code (in the onSuccess). You seem to be cutting and pasting from different sources.
The full code to auto-submit and redirect is:
<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_1057"></form>
<script>
MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
// Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
location.href = "https://www.surveymonkey.com/r/5KQ3VGB";
// Return false to prevent the submission handler continuing with its own processing
return false;
});
form.submit();
});
</script>
You will need the Munchkin JS and Muchkin.init() as well. But, as I've noted, your resulting code will have a race condition. It will not satisfy your requirements reliably. I would not use it on a production site.
Hi Sanford,
For some reason the page goes no wear, here is the full script
<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_2190"></form>
<script>
MktoForms2.loadForm("//app-sjst.marketo.com", "663-HBN-994", 2190, function(form) {
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
// Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
location.href = "https://www.surveymonkey.com/r/5KQ3VGB";
// Return false to prevent the submission handler continuing with its own processing
return false;
});
form.submit();
});
</script>