AnsweredAssumed Answered

Changing form return URL to token value based on selection

Question asked by 540d4c2f8c5d77cec876bb0eafd9dbdb40b95526 on Nov 23, 2015
Latest reply on Nov 24, 2015 by Sanford Whiteman

Hey all, been working on this for hours today and am unable to find a solution.

 

I'm trying to make it so the form "ret" value, that is, the page that it redirects to after submission, changes based on the value of a certain radio button on the form. I am building an event RSVP form. Depending on if the user chooses "Yes", "No" or "Maybe" on the form, it will redirect them to a different "Thanks" page with appropriate text. The URL of this thanks page is set by a program token - {{my.RSVP Yes URL}}, {{my.RSVP No URL}}, {{my.RSVP Maybe URL}}.

 

I have found another topic addressing this question here: redirecting to different pages depending on form fields chosen - however, this solution does not work for me (and it also mentions a Marketo help article on the topic that I cannot find). It appears that the fields used in that solution, "returnURL" and "retURL", may no longer be used in marketo forms. The relevant hidden field is now simply named "ret", and it is only visible as part of a <noscript> section. Here is a basic version of the code I tried to just get the field to update to a sample value (google.com):

 

function changeFollowupURL() {
  // first, set the default follow up page
  var URL = 'http://www.google.com';

  $('input[name="returnURL"]').val(URL);
  $('input[name="retURL"]').val(URL);
  $('input[name="ret"]').val(URL);
  return true;
}
      
function formSubmit(elt) {
  alert ("submitted form");
    changeFollowupURL();
    return Mkto.formSubmit(elt);
}

 

This does not work. I'm thinking it's because the only place the hidden value is defined is in <noscript></noscript> but I'm not sure about that.

 

Does anyone have tips on how to make this happen? Thank you!!

Outcomes