See how our platform helps you improve performance, strengthen compliance and deliver measurable impact. Book a personalised demo to explore the features and benefits most relevant to your organisation.

Request a tailored walkthrough with one of our specialists. We’ll show you how the platform works, answer your questions and focus on the areas that matter most to your organisation.

0333 049 6966

info@compliancechain.com

    Social Value ManagementSupply Chain ManagementProject ManagementSupplier MembershipImpact
    document.addEventListener('DOMContentLoaded', function () { console.log("DOMContentLoaded"); // Find the CF7 form on the page – assumes your form has the wrapper class "compliance-chain-form" const element = document.querySelector('.compliance-chain-form'); const form = element.closest('form'); // 🔧 FIELD MAPPINGS 🔧 // Map CF7 field names (left side) to Pardot field names (right side). // Update the Pardot field names to match your Pardot form handler settings. const fieldMappings = { 'FIRSTNAME': 'First_Name', // Pardot usually splits into First + Last, but you can pass full_name if set 'LASTNAME': 'Last_Name', 'EMAIL': 'Email', // Required in Pardot 'COMPANY': 'Company', 'REGION': 'Region', 'DISCIPLINE': 'Discipline', 'INTEREST_PRODUCT' : 'Product_of_Interest' }; const checkboxFields = ['INTEREST_PRODUCT']; // Pardot form URL const formUrl = 'https://go.cc.be-bold.co.uk/l/1099132/2025-07-29/41ty1q'; // Change as required form.addEventListener('submit', function (event) { // Gather all form data from CF7 const formData = new FormData(form); // Split "your-name" into first + last for Pardot if needed let firstName = ''; let lastName = ''; if (formData.get('YOUR_NAME')) { const fullName = formData.get('YOUR_NAME').trim(); const nameParts = fullName.split(/\s+/); firstName = nameParts.shift() || ''; lastName = nameParts.join(' '); } // Build Pardot submission data const urlParams = new URLSearchParams(); // Select all inputs under the form-field with data-name="INTEREST_PRODUCT" const checkboxes = document.querySelectorAll('.form-field [data-name="INTEREST_PRODUCT"] input[type="checkbox"]'); // Collect the values of only the checked ones const selectedValues = Array.from(checkboxes).filter(checkbox => checkbox.checked).map(checkbox => checkbox.value); let productsOfInterest = ''; if (selectedValues?.length > 0) { productsOfInterest = selectedValues.join(';') urlParams.append(fieldMappings['INTEREST_PRODUCT'], productsOfInterest); } // Handle all other fields (skip the checkbox ones we already processed) formData.forEach((value, key) => { if (fieldMappings[key] && !checkboxFields.includes(key)) { console.log(fieldMappings[key], ": ", value); urlParams.append(fieldMappings[key], value); } }); // Console params console.log('-- Submission Params Start --'); for (const [key, value] of urlParams.entries()) { console.log(`${key}: ${value}`); } console.log('-- Submission Params End --'); // 🔧 ADDITIONAL HIDDEN FIELDS 🔧 // These can be set up in your Pardot form handler if needed. // urlParams.append('lead_source', 'Website'); // Example static field // 🔧 PARDOT ENDPOINT 🔧 // Replace with your Pardot Form Handler URL fetch(formUrl, { method: 'POST', body: urlParams, mode: 'no-cors', headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(response => { // Because of no-cors, you won't see a success response here. // You can optionally trigger a redirect or thank-you message if desired. }).catch(error => { console.error('Error occurred during Pardot submission:', error); }); }); });
    Discover how we can support your organisation with performance, compliance, and measurable impact.

    0333 049 6966

    info@compliancechain.com

    Request a call with our Product Specialist

    Fill in the form below and a member of our team will be in touch

      By submitting you agree to receive other communications from Compliance Chain and you accept our privacy policy.