The form is captured with Lead Type Contact Us. The request is to capture the same form and assign it to different Lead Types depending on the selected service not the generic Contact Us.
I added a code that assigns a specific class depending on the selected service. Then, this class is used to determine which Lead Type to assign.
form.addClass('mcfx-custom-class-contact-form');
var classesToRemove = ['mcfx-custom-class-contact-form', 'mcfx-custom-class-becoming-a-surrogate', 'mcfx-custom-class-becoming-a-parent', 'mcfx-custom-class-legal-services-only'];
var interestInput = document.querySelectorAll('input[name="field87126896"]');
if (interestInput) {
interestInput.forEach(i => {
if (i.checked) {
classesToRemove.forEach(className => {
i.form.classList.remove(className);
});
i.form.classList.add('mcfx-custom-class-' + i.value.toLowerCase().replace(/ /g, '-'));
}
i.addEventListener('change', e => {
classesToRemove.forEach(className => {
e.target.form.classList.remove(className);
});
e.target.form.classList.add('mcfx-custom-class-' + e.target.value.toLowerCase().replace(/ /g, '-'));
});
});
}
The lead was captured, and the correct lead type was properly assigned.
Ticket: Link