Skip to main content
Solved

Adding form values to redirect URL

  • March 30, 2021
  • 1 reply
  • 1225 views

Forum|alt.badge.img+2

I am trying to use the Go To URL action for after my signup form has been submitted. I can get this working with a fixed URL, but I want to add a parameter to the URL based on the user input in the form, eg:

https://example.com/process?email={{ person.email }}

I’ve tried using the syntax from a flow for this, but it doesn’t get substituted. Is there a way to use values that the user has submitted in the destination URL?

Thanks
David

Best answer by dmpatrolio

So I was able to find another solution to this. Instead of using the Go To URL action on submit, I instead made my form show a success message, then added a snippet of javascript to the web in which the form was embedded:

<script>
window.addEventListener('klaviyoForms', function(e) {
  if (e.detail.type == 'submit' && e.detail.formId == "XXXXX") {
    const emailEnc = encodeURIComponent(e.detail.metaData.$email);
    window.location.assign(
      `https://example.com/process?email=${emailEnc}`
    );
  }
});
</script>

 

View original
Did this topic or the replies in the thread help you find an answer to your question?

1 reply

Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • Answer
  • March 31, 2021

So I was able to find another solution to this. Instead of using the Go To URL action on submit, I instead made my form show a success message, then added a snippet of javascript to the web in which the form was embedded:

<script>
window.addEventListener('klaviyoForms', function(e) {
  if (e.detail.type == 'submit' && e.detail.formId == "XXXXX") {
    const emailEnc = encodeURIComponent(e.detail.metaData.$email);
    window.location.assign(
      `https://example.com/process?email=${emailEnc}`
    );
  }
});
</script>