Redirect via Webhook After Form Submission

Thank you! This has worked for me!

Hi @artur, @adalys and @Nickshas

The new script finally works for me :pray: Thanks a lot

I would like to share a tip that took me a while to find : don’t forget to use “https://…” in the redirect URL :innocent:

1 Like

I added this script to Scissors.

2 Likes

@Artur I’m seeing something unexpected.

I would have thought that the name of the event being dispatched would be submit-form-success- followed by the id of the form.

What I’m actually seeing is that the name of the event being dispatched is always submit-form-success-form1 no matter what the id of the form is.

Is this a bug or expected behavior?

this must be a bug @dcoletta let me check with the team!

@dcoletta we checked and seems to be working fine can you perhaps do a loom and show the issue ?

I can’t reproduce it any more. I think I must have made a mistake in my testing. Sorry about that! All is well.

Does anyone know of a similar solution for redirecting to a dynamic URL when the form is creating a new AT record?

I have multiple forms on the same page and it appears the script only works on the 1st form created? The redirect doesn’t work for me on form2 and form3.

I think I’ve figured out how the script works. The form name needs to match this part of the script:

window.addEventListener('submit-form-success-**form name**', (e) => {

1 Like

Would be very helpful or is there a way to append one of the form field value pairs to the redirect string ?

1 Like

@artur Is there a way to make this redirect happen within a modal? Its works when the redirect happens from a page but not when a form is submitted within a modal. I thought maybe it was Stripe blocking the opening of a payment link in a modal, so I switched the URL to google to test but that would not open in the modal either, so I’m assuming this is something I can workaround with the custom code in Softr? Attached is a screenshot of what the redirect inside the modal looks like. Any help sorting this out would be greatly appreciated!

@artur I’m noticing that whenever I have a webhook response module in Make, Sofrt will continually retrigger the initial wehbook every minute until it times out. So Make is getting triggered twice per form submit, and no response received. This only happens (I think) when the Make flow takes over 60 seconds to complete. When I remove the webhook response from the end of the Make flow entirely, the form only triggers once.

If the entire Make flow takes <60 seconds, the webhook response is correctly received by Softr.
So it must be something to do with timeouts? But I thought webhook timeouts were 120 seconds. Is this a bug?

@EnigmaXXIII I tried it out and it did send only one and the request took 75 seconds. Do you have anything visual to show? that could help me.
BTW keep in mind typically there is a preflight request and real request when it comes to calling this party APIs in case it helps.

@artur yes - I’ve just sent a video via chat so you can see. I don’t know why your request didn’t trigger 2 instances, but I’ve done a screen recording showing me submitting a single test form and it triggering 2 flows in Make (1 minute apart), then an error on the front end in Softr. Hopefully that recording helps?

@EnigmaXXIII I’m troubleshooting this right now and will get back asap.

@artur is there a way to accomplish this redirect (via Webhook response after form submission) without custom code?

We could enable it, but we need to have some convention like if the form sends us a response with the following response then we do redirect.

Let’s me discuss this with the team.

Thank you. The way it works with your code is great - with the spinner on the “submit” button. Doing it natively would be most appreciated.

Any luck? :slight_smile: