Currently I am using the below to redirect after submission and it works great. I just want to make sure there aren't any other fail safes I can build in if the form cannot submit.
var firstVal = document.getElementById("FirstName").value;
var lastVal = document.getElementById("LastName").value;
var phoneVal = document.getElementById("Phone").value;
var emailVal = document.getElementById("Email").value;
location.href = "website?phone=" + phoneVal + "&firstname=" + firstVal + "&lastname=" + lastVal + "&email=" + emailVal;
Out of curiosity, why are you re-directing with PII in the query string and what does the destination page do with it? There may be better ways to implement what you're trying to accomplish
I am re-directing with the query string since the destination page goes to our app and needs the values in the url to pull that info. I hope that makes sense. I am new to Marketo so still figuring out the best way to do this.
Hope this isn't your actual code because it's... totally wrong.
You're using the signature of the onSuccess(values, followUpUrl) but calling the onSubmit, which is a different point in the process.
And you're needlessly using getElementById when the values variable is designed for this purpose.
I am new to Marketo and still trying to figure out the best way to accomplish this. I see that I should use onSuccess for the re-direct but how would I use the values variable in this instance?
vals['FirstName']; // is the value the lead typed for First Name
What I would do in your case is at least Base64-encode the PII, if you must transmit in the URL. Not that it changes anything, really, because it can be trivially decoded. But at least the lead her/himself doesn't see their data in the clear. That being said, I work with big shops and many just pass emails in URLs willy-nilly.
As Justin said, you are using querystring parameters to pass the information to the 'website'. Problem is that the personal information is visible to the user. It can be changed / used maliciously in the browser url etc.
It is better to use HTTP Post (where one can not directly see the data being passed) or other mechanisms.
More to your direct question, the event model does not include onFailure. You could, although I hate to ever suggest this, use a timer and a sentinel variable to see if onSuccess has fired. But like the others, I'm not really clear on what you're trying to do here.
I basically want to know if marketo loads the form but when a user fills out the form and clicks submit and marketo for some reason cannot be reached if my redirect will still function.