I design a lot of landingpages. Many companies use landingpages to showcase downloads (whitepapers, brochures, etc) which can be downloaded after filling out a contact form (to collect contact information). Many of these landingpages (if not, all) need seperate thank-you pages for each of the landingpages. Now, for many of these sites, I create these landingpages using CMS.
Using CMS, I can’t set custom Redirect URLs for each contact form in the Template pages. Only 1 static redirect url is available for each form. I imagine, it would be a fairly small addition in the Webflow form settings to make the Redirect URL a dynamic field. Which would mean, we can insert a thank-you URL in the CMS item, and grab choose to use that URL in the form Redirect settings.
@rowan Your description captures my situation exactly. Have you (or anyone else affected by this limitation) found a workaround or even a way to customize the Success Message with reference to the CMS item?
@rowan Using a url from the CMS Item for the direct url field on a form is a great idea.
@eburnett You can customize the Success Message easily. For example include a text field in the CMS Item for the Success Message and link that to the paragraph. Then you an even go a step further and add a button that is either defined by the CMS Item or conditional based on a field in the CMS Item.
Thanks @matthewpmunger! Those are helpful ideas and ones I hadn’t thought of - appreciate the response and ideas. I’m also looking into custom javascript to unbind the webflow form handling, grab the slug out of the url and provide a custom action using that slug.
@rowan Hi! If you still need help with that, here is my solution with custome code. So you need to set attributes to the form and this is how you can do it. Hope it will help!
@Hunter_Reynolds
Thank you for trying my method! Try to set the “sign-in-form” id not to the Form block, but the Form itself (which is inside the form block). And also it may require cleaning the From Block ID (I did’t test actually)
.attr is a Jquery function to set an attribute to a specific element. In this way you can rewrite default Webflow settings and add redirect link with Custom Code
@Igor_Voroshilov had exactly the same thought; only difference was I used plain JS i.e.
const form = document.getElementById(<form-id>);
form.setAttribute("redirect", url);
form.dataset.redirect = url;
This updates the attributes on the form element correctly (I can see them on inspection after page load) however on form submission it redirects to the original redirect URL set in Webflow
Wondering if they’ve updated their implementation since last year
Here is updated code I used that is working for me. This custom code goes in page settings, before the /body
<script>
$(function() {
const $form = $("#FORM_ID_GOES_HERE");
// Capture the form submit event
$form.on("submit", function(e) {
e.preventDefault(); // Prevent the default form submission
// Get the URL for the PDF file from the current collection item
const pdfUrl = "{DYNAMIC CMS FIELD HERE}";
// Redirect to the PDF URL and open it in a new tab
window.open(pdfUrl, '_blank');
return false; // Prevent any further form submission actions
});
});
</script>