Capture a form where the inputs disappears and not available during submission

gerard_reyes Posted by: Gerard Reyes Date Posted: October 25, 2024
Back to Case Studies

Issue

The form is a multi-step form where the inputs from the 1st part disappears during the 2nd part of submission.

Solution

Create a code to temporarily capture the 1st part, then overwrite if the client continues with the 2nd part

<script>
document.querySelectorAll('.kl-private-reset-css-Xuajs1').forEach(button => {
button.addEventListener('click', () => {
let emailAddressInput = document.getElementById('email_111334794');
let phoneNumberInput = document.getElementById('phone_number_111334800');

let emailAddress = emailAddressInput ? emailAddressInput.value : '';
let phoneNumber = phoneNumberInput ? phoneNumberInput.value : '';

captureFauxForm(emailAddress, phoneNumber);
});
});

function captureFauxForm(email, phone) {
let fields = {
email: email,
phone: phone
};

// Assuming mcfx is a predefined function for form submission
mcfx(fields);
}
</script>

Achievement

Lead was captured.

Snippet/Screenshot/Link

Code

Task