Solved

Adding form values to redirect URL

  • 30 March 2021
  • 1 reply
  • 646 views

Badge +1

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

icon

Best answer by dmpatrolio 31 March 2021, 03:00

View original

1 reply

Badge +1

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>

 

Reply