section to parse URL parameters and auto-fill matching fields on page load.
You can auto-fill form fields in Webflow using values passed through the URL query string by using custom JavaScript. Here’s how to implement it correctly so fields autopopulate when specific parameters are present in the URL.
?firstName=John
.<script> window.addEventListener('DOMContentLoaded', () => { const params = new URLSearchParams(window.location.search); params.forEach((value, key) => { const field = document.querySelector(`[name="${key}"]`); if (field) field.value = value; }); });</script>
https://yourdomain.com/page?firstName=John&email=test@example.com
?firstName=John%20Doe&email=john%40example.com
To auto-fill form values in Webflow from a URL's query string, give form fields appropriate Name attributes and use a small JavaScript snippet that matches those names to query parameters. This works effectively for simple personalization or lead-tracking use cases.