Thank you for your submission

INTRANET

At Solve Safety we use and recommend Lucidity Safety, Quality & Environmental software.

// Site-Wide Form Field Fix for Solve Safety - Exsalerate CRM Integration // This script should be added to your website's global footer or header (function() { 'use strict'; let fixAttempts = 0; const maxAttempts = 10; // Comprehensive list of possible first name field selectors const firstNameSelectors = [ // Common name attributes 'input[name="firstname"]', 'input[name="first_name"]', 'input[name="FirstName"]', 'input[name="first-name"]', 'input[name="fname"]', // Common ID attributes 'input[id="firstname"]', 'input[id="first_name"]', 'input[id="FirstName"]', 'input[id="first-name"]', 'input[id="fname"]', // Class-based selectors '.firstname input', '.first-name input', '.fname input', 'input.firstname', 'input.first-name', // Data attributes '[data-field="firstname"] input', '[data-field="first_name"] input', '[data-name="firstname"]', // Exsalerate specific selectors (common patterns) 'form[data-source="exsalerate"] input[type="text"]:first-of-type', '.exsalerate-form input[type="text"]:first-of-type', // Generic form selectors (first text input in contact forms) 'form input[type="text"]:first-of-type', '.contact-form input[type="text"]:first-of-type', '.consultation-form input[type="text"]:first-of-type' ]; // Function to enable and fix form fields function enableFormFields() { let fieldsFixed = 0; fixAttempts++; console.log(`Solve Safety Form Fix - Attempt ${fixAttempts}`); firstNameSelectors.forEach((selector, index) => { try { const fields = document.querySelectorAll(selector); fields.forEach(field => { if (field && (field.disabled || field.readOnly || field.style.pointerEvents === 'none')) { // Enable the field field.disabled = false; field.readOnly = false; // Fix styling issues field.style.opacity = '1'; field.style.pointerEvents = 'auto'; field.style.backgroundColor = ''; field.style.cursor = 'text'; field.style.color = ''; // Remove problematic classes field.classList.remove('disabled', 'readonly', 'inactive'); // Ensure proper attributes field.setAttribute('tabindex', '0'); field.removeAttribute('readonly'); field.removeAttribute('disabled'); // Add placeholder if missing if (!field.placeholder) { field.placeholder = 'Enter your first name'; } fieldsFixed++; console.log(`Fixed field with selector: ${selector}`); // Add event listener to ensure field stays enabled field.addEventListener('focus', function() { this.disabled = false; this.readOnly = false; }); } }); } catch (error) { console.log(`Error with selector ${selector}:`, error); } }); // Also fix any iframe forms (if Exsalerate uses iframes) const iframes = document.querySelectorAll('iframe'); iframes.forEach(iframe => { try { if (iframe.contentDocument) { const iframeFirstName = iframe.contentDocument.querySelector('input[name*="first"], input[id*="first"]'); if (iframeFirstName) { iframeFirstName.disabled = false; iframeFirstName.readOnly = false; fieldsFixed++; console.log('Fixed iframe first name field'); } } } catch (error) { // Cross-origin iframe access - can't fix console.log('Cannot access iframe content (cross-origin)'); } }); if (fieldsFixed > 0) { console.log(`Solve Safety Form Fix: Fixed ${fieldsFixed} field(s) on attempt ${fixAttempts}`); } else if (fixAttempts < maxAttempts) { // Retry if no fields found yet setTimeout(enableFormFields, 500); } return fieldsFixed; } // Function to add CSS fixes function addCSSFixes() { const existingStyle = document.getElementById('solve-safety-form-fix'); if (existingStyle) return; // Already added const style = document.createElement('style'); style.id = 'solve-safety-form-fix'; style.textContent = ` /* Solve Safety Form Fix - Override any conflicting styles */ /* First name field fixes */ input[name*="first"], input[id*="first"], .firstname input, .first-name input, [data-field*="first"] input, form input[type="text"]:first-of-type { opacity: 1 !important; pointer-events: auto !important; background-color: #ffffff !important; border: 1px solid #ddd !important; cursor: text !important; color: #333 !important; padding: 8px 12px !important; } /* Hover and focus states */ input[name*="first"]:hover, input[id*="first"]:hover, input[name*="first"]:focus, input[id*="first"]:focus { border-color: #007cba !important; outline: none !important; box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1) !important; } /* Ensure disabled state is visible but still functional */ input[name*="first"]:disabled, input[id*="first"]:disabled { opacity: 1 !important; background-color: #ffffff !important; cursor: text !important; pointer-events: auto !important; } /* Fix for any wrapper elements */ .form-field:has(input[name*="first"]), .input-wrapper:has(input[name*="first"]) { opacity: 1 !important; pointer-events: auto !important; } /* Mobile responsive fixes */ @media (max-width: 768px) { input[name*="first"], input[id*="first"] { font-size: 16px !important; /* Prevents zoom on iOS */ padding: 12px !important; } } `; document.head.appendChild(style); console.log('Solve Safety Form Fix: CSS fixes applied'); } // Initialize the fix function initializeFormFix() { console.log('Solve Safety Form Fix: Initializing...'); // Add CSS fixes first addCSSFixes(); // Enable form fields enableFormFields(); // Try again after common script loading delays setTimeout(enableFormFields, 1000); setTimeout(enableFormFields, 2000); setTimeout(enableFormFields, 3000); } // Multiple initialization strategies if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initializeFormFix); } else { initializeFormFix(); } // Backup initialization window.addEventListener('load', function() { setTimeout(enableFormFields, 500); setTimeout(enableFormFields, 1500); }); // Watch for dynamic content changes (AJAX loaded forms) if (window.MutationObserver) { const observer = new MutationObserver(function(mutations) { let shouldCheck = false; mutations.forEach(function(mutation) { if (mutation.addedNodes.length) { // Check if any new form elements were added mutation.addedNodes.forEach(function(node) { if (node.nodeType === 1) { // Element node if (node.tagName === 'FORM' || node.querySelector && node.querySelector('form') || node.querySelector && node.querySelector('input')) { shouldCheck = true; } } }); } }); if (shouldCheck) { setTimeout(enableFormFields, 100); } }); observer.observe(document.body, { childList: true, subtree: true }); } // Expose a global function for manual fixing if needed window.solveSafetyFixForms = enableFormFields; console.log('Solve Safety Form Fix: Script loaded and ready'); })();