page_url
to your form symbol.window.location.href
to dynamically populate the hidden field on page load.To automatically capture the current page URL in Webflow forms, even when the form is used as a symbol, you can use a simple script and dynamic hidden fields—without editing each form individually.
page_url
.page_url
:<script> document.addEventListener("DOMContentLoaded", function () { const url = window.location.href; document.querySelectorAll('input[name="page_url"]').forEach(function(input) { input.value = url; }); });</script>
This script waits for the page to load, then assigns the current URL to any form input with the name page_url
.
To include the current page URL in a Webflow form without editing each form individually, add a hidden field (e.g., page_url
) to your form symbol and use a script to fill it dynamically with window.location.href
. This works across all pages where the symbol is used, maintaining full reusability.