Hi! I have a CMS collection set up for events with a registration form.
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.
I have the custom code below to redirect to the recording link, otherwise it shows an acknowledgement banner on the page:
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).
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.
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
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.