html
Copy code
<script>
// Function to handle form submission
function handleFormSubmit(event) {
event.preventDefault(); // Prevent default form submission
var formData = new FormData(event.target);
var userType = formData.get('how_can_boundless_help'); // Ensure this matches the form field name
// Define the calendar URLs
var accountExecutiveCalendarUrl = 'https://meetings.hubspot.com/account-executive-calendar'; // Replace with the actual URL
var sdrCalendarUrl = 'https://meetings.hubspot.com/sdr-calendar'; // Replace with the actual URL
// Build query string from form data
var queryString = new URLSearchParams();
queryString.append('firstname', formData.get('firstname'));
queryString.append('lastname', formData.get('lastname'));
queryString.append('company', formData.get('company'));
queryString.append('jobtitle', formData.get('jobtitle'));
queryString.append('email', formData.get('email'));
// Redirect based on user type
if (userType === 'I am an employer') {
window.location.href = accountExecutiveCalendarUrl + '?' + queryString.toString();
} else if (userType === 'I am an employee') {
window.location.href = sdrCalendarUrl + '?' + queryString.toString();
}
}
// Wait for the DOM to be fully loaded
document.addEventListener('DOMContentLoaded', function() {
var formElement = document.querySelector('form'); // Adjust the selector to target your form
formElement.addEventListener('submit', handleFormSubmit);
});
</script>