Custom Form Redirect URL based on CMS value

Hello is there a way to set a Redirect URL of a Webflow Form from a CMS value?

Not natively in Webflow, no.

But you do have some options if you put a tad bit of effort into it.

If you do all of this on a CMS Collection page you’ll have access to the CMS values.

Javascript Approach:

Then you could take control of the form submit with Javascript and do this client side.

Here is some example Javascript code from one of my screencasts walking through something similar.

Make (Integromat) Approach:

Or you could submit your form (and the value in a hidden field) to a free Make (Integromat) account.

This is almost always the better approach.

Submit the form to a Webhook and create a response module that tells the web browser to redirect to any page you’d like.

Here’s a screencast walking through how to do this with Make (Integromat) Webhooks.

This one shows you how to use Javascript to display the success / error message. Not 100% what you’re looking for:

But this tutorial has a section showing how to setup the Webhook response module (scroll down a little) and redirect the web browser:

I’m assuming the form is on a collection page, and that the redirect URL you want is already in that collection.

Put an ID like booking-form directly on your form element ( not the form block element, but the form element ).

image

Then in your </body> you can drop in a bit of jquery to set that redirect;

$(function() {
  const $form = $("#booking-form");
  $form.attr("redirect") = " YOUR VAR HERE ";
  $form.data("redirect") = " YOUR VAR HERE ";
});

On a collection page, you’ll see that you can insert collection fields where YOUR VAR HERE is indicated. Note that Webflow emits FORM HTML including both a redirect and a data-redirect attribute, so we’re updating both, to be complete.

If this form is inside of a collection list, the approach will be similar however you’ll need to get a bit more creative on targeting your form. You can’t reliably use ID’s there since you’ll have N copies of that same form.