We have a Gravity Form custom snippet that uses the checkbox label as the input data value instead of a raw data value. However, it had an issue with the integration configuration between Gravity Form and LeadManagerFX. As a result, the lead results coming from LeadManagerFX and Gravity Form are being sent to spam files.
A suggestion from Felipe gave me an idea of what custom snippet I will construct.
The custom snippet’s only function is to manipulate the checkboxes’ label value as input value.
(function() {
// Get all the checkbox inputs
var checkboxes = document.querySelectorAll('input[type="checkbox"][name^="input_10"]');
// Create the hidden input field
var hiddenInput = document.createElement('input');
hiddenInput.type = 'hidden';
hiddenInput.name = 'fx-services';
hiddenInput.id = 'Services';
// Function to update the hidden input's value
function updateHiddenInput() {
var selectedValues = [];
checkboxes.forEach(function(checkbox) {
if (checkbox.checked) {
selectedValues.push(checkbox.value);
}
});
hiddenInput.value = selectedValues.join(', ');
}
// Attach event listeners to the checkboxes
checkboxes.forEach(function(checkbox) {
checkbox.addEventListener('change', updateHiddenInput);
});
// Initially update the hidden input (in case any are checked by default)
updateHiddenInput();
// Find the container to append the hidden input to (e.g., the form)
var container = document.querySelector('.ginput_container_checkbox');
if (container) {
container.appendChild(hiddenInput);
} else {
console.error('Container not found. Ensure the selector is correct.');
}
})();
I was able to provide the requested data to be pulled correctly in the leads, and didn’t break the Gravity Form integration with LeadManagerFX.