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

Anonymous
Not applicable

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

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
Justin_Cooperm2
Level 10

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

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

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

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.

SanfordWhiteman
Level 10 - Community Moderator

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

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

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

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

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

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

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

Thank you. I appreciate the help.

Anonymous
Not applicable

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

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

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

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.

Anonymous
Not applicable

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

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.