How do I redirect to different URLs in a CMS form?

Hi! I have a CMS collection set up for events with a registration form.

  1. There are 3 form buttons depending on CMS attributes: “Register now” if the event is upcoming, “Sign up” if the event is past and there’s no recording link, and “Watch now” if the event is past and there’s a recording link.

  2. I have the custom code below to redirect to the recording link, otherwise it shows an acknowledgement banner on the page:

<script>
$('#Event-Form')
.attr('redirect','Recording link')
.attr('data-redirect','Recording link');
</script>

What I’m trying to do now is redirect to this URL (You're registered!) only for the “Register now” state. I would want the other states to remain the same (“Watch now” redirects to the recording link and “Sign up” shows the acknowledgement banner).

Let me know if this makes sense!


Here is my site Read-Only: Webflow - Epoch

Hi, is anyone able to answer my question? It’s blocking a flow that the sales team is requesting from me, so it would be great to know if this is possible or if I need to look into alternatives.

Hi Angie,

I’m not seeing a form on the page you shared. But without digging into the exact specifics of your setup and objectives, I can suggest a few approaches for this type of conditional routing.

DISCRETE FORMS

  • Have 3 different forms / cards, etc.
  • They’re essentially identical except the button and the form settings vary
  • Each form has its own redirect setting on a successful submit
  • You conditionally show just the appropriate one, based on whether it’s past, present, future, or the recording link is populated in the CMS

JS REDIRECT
You can definitely do a script-based redirection as well

  • You might be able to dynamically update Webflow’s success redirect link in your form attributes, and let Webflow.js handle the redirect
  • Alternatively you can have code watch the form submit, look at the data, and write to sessionStorage. On the page you redirect to, you look at that detail, and then redirect to the appropriate result page

@memetican Sorry, here’s the correct link to the form page: Webflow - Epoch

It would be great if you could confirm if this changes anything, but it sounds like the the former option would be better for me since I’m not familiar with code.

Just for future reference, could you elaborate on the first JS redirect option? I’m not sure if I understand how this solution works.

Hi Angie,

I don’t really have anything to add, if you’re not a coder, you’ll want to use 3 forms and Webflow’s conditional visibility.

I’d have to build out the script based approach to give you further details there.

@memetican Thanks so much for the help!

1 Like