When collecting leads through Webflow forms that lead to Calendly bookings, users often need to enter their information twice: once in your form and again on the Calendly page. This guide shows you how to automatically pass information from your Webflow forms to Calendly using data attributes, eliminating duplicate data entry and improving conversion rates.
Unlike other solutions that require manual setup of form IDs and separate JavaScript for each form, our approach uses dynamic data attributes that automatically handle any number of forms on your site. This means less code, easier maintenance, and a better experience for both you and your users.
Traditional implementations often require you to manually set up form IDs and write separate JavaScript for each form-to-Calendly connection. This approach is not only time-consuming but also prone to errors and difficult to maintain. Our solution using data attributes offers several advantages:
Before diving into the implementation, let's understand the core concept. When a visitor submits your Webflow form, our script:
Add this script to your Webflow project by going to Project Settings > Custom Code > Footer code and pasting it in the code box.
If you only want the functionality on a specific page of your Webflow project, you can add it to the Before </body> tag custom code section under Page Settings instead.
<script>
/**
* BRIX Templates Calendly Pre-fill Handler
* Automatically pre-fills Calendly forms from Webflow form submissions
* @version 1.0.0
*/
(function() {
'use strict';
function initBrixCalendlyPrefill() {
// Find all forms with the Brix Calendly redirect attribute
const calendlyForms = document.querySelectorAll('form[data-brix-calendly-redirect]');
if (!calendlyForms.length) {
console.log('No forms with [data-brix-calendly-redirect] attribute found.');
return;
}
calendlyForms.forEach(form => {
form.addEventListener('submit', function(e) {
e.preventDefault();
// Get base Calendly URL
const baseCalendlyURL = form.getAttribute('data-brix-calendly-redirect');
if (!baseCalendlyURL) {
console.log('No Calendly URL specified in data-brix-calendly-redirect');
return;
}
// Collect parameters from form fields
const queryParams = [];
const fieldInputs = form.querySelectorAll('[data-brix-calendly-field]');
fieldInputs.forEach(input => {
const paramName = input.getAttribute('data-brix-calendly-field');
const paramValue = encodeURIComponent(input.value.trim());
if (paramValue) {
queryParams.push(`${paramName}=${paramValue}`);
}
});
// Build final URL with parameters
let finalURL = baseCalendlyURL;
if (queryParams.length > 0) {
finalURL += (finalURL.includes('?') ? '&' : '?') + queryParams.join('&');
}
console.log(`Redirecting to Calendly: ${finalURL}`);
window.location.href = finalURL;
});
});
}
// Run when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initBrixCalendlyPrefill);
} else {
initBrixCalendlyPrefill();
}
})();
</script>
For each form field you want to pre-fill in Calendly, add the appropriate data attribute:
Calendly supports various parameters for pre-filling booking information. Here are the most commonly used ones:
Basic information
Contact and location options
Custom questions
1. Publish your site: Ensure your site is published (ideally we recommend to test first on staging) with all custom attributes and scripts.
2. Test the form: Submit the form with sample data.
3. Check the redirect: Verify you're taken to Calendly with all parameters in the URL.
4. Verify the data: Confirm all fields are correctly pre-filled on the Calendly page.
Form doesn't redirect to Calendly
Fields aren't pre-filling
Custom questions aren't working
By using BRIX Templates' data attributes for Calendly pre-filling, you've implemented a flexible, maintainable solution that can grow with your needs. This approach eliminates the common pitfalls of manual ID-based implementations while providing a seamless booking experience for your users.
Remember to keep your Calendly event settings in sync with your form fields, and regularly test the booking flow to ensure everything works as expected. As your needs evolve, this system can easily accommodate new forms and fields without requiring code changes.
Need help with more advanced connections between Webflow and Calendly, or looking to integrate other third-party services with your Webflow site? Our team of Webflow pros is here to help – just send us a message, and we'll help you create the perfect integration for your needs.
Learn how to add animated number counters to your Webflow site. This step-by-step guide explains how to do it in 5 minutes or less.
Learn how to add a copy URL button to your Webflow site. Step-by-step guide for implementing easy page sharing without plugins or code.
Learn how to add copy-to-clipboard button to your Webflow site in 5 minutes or less.