Is there a way to setup an action if the our marketo form fails and hangs on "Please Wait" when submitted?

Anonymous
Not applicable

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.

function(form) {

    form.onSuccessfunction(values, followUpUrl){

        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;

        return false;

    });

Tags (1)
10 REPLIES 10
SanfordWhiteman
Level 10 - Community Moderator

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.

Grégoire_Miche2
Level 10

Hi Sanford,

"Onfailure" event is an idea to post

-Greg

Anonymous
Not applicable

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.

Anonymous
Not applicable

Hi Matt,

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.

Apart from that, there might not be too much of 'fail safe' mechanism that is needed for simple redirects. One thing is what if the javascript is blocked by the browser, but that might not be too prominent.

Rajesh

SanfordWhiteman
Level 10 - Community Moderator

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.

Anonymous
Not applicable

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?

SanfordWhiteman
Level 10 - Community Moderator

form.onSuccess(function(vals,tyURL){

  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.

Anonymous
Not applicable

Thank you. I appreciate the help.

Justin_Cooperm2
Level 10

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

Anonymous
Not applicable

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.