IX Trigger
option of the Attributes Form Submit to trigger a click event on an element.<!-- [Attributes by Finsweet] Form Submit Actions -->
<script defer src="<https://cdn.jsdelivr.net/npm/@finsweet/attributes-formsubmit@1/formsubmit.js>"></script>
<!--Calendly-->
<script type="text/javascript" src="<https://assets.calendly.com/assets/external/widget.js>"></script>
/* Prefill Calendly on Form Submission */
document.addEventListener("DOMContentLoaded", function() {
var nameInput = document.getElementById("contact-name"); //Name Field
var emailInput = document.getElementById("contact-email"); //Email Field
var calendlyTarget = document.getElementById("form-calendly-widget"); //Target div for calendly embed
// Add Calendly on form submission
document.getElementById("calendly_trigger").addEventListener("click", function() {
var nameValue = nameInput.value;
var emailValue = emailInput.value;
Calendly.initInlineWidget({
url: '{{YOUR_CALENDLY_URL}}?hide_landing_page_details=1&hide_event_type_details=1',
parentElement: calendlyTarget,
prefill: {
name: nameValue,
email: emailValue
},
});
});
// Remove Calendly on form reset (optional for form reset)
document.getElementById("reset-form-button").addEventListener("click", function() {
calendlyTarget.innerHTML = '';
});
});
NOTE: use this for the Calendly target div or create a div inside Webflow and add the same attributes and styles
<div class="calendly-inline-widget" style="min-width:320px;height:580px;" data-auto-load="false"></div>
Adding data-auto-load=”false”
to the target div is important in order to make it work
We will use cookies to store the data and then prefill it on the thank you page