Input values in the first form disappear upon submission. Leaving the second form with no way to identify who previously transacted or connect it to the first form.
Store the values of the first form in a temporary variable storage during the first submission. Keep the values for the second form blank.
var tempStorage = {};
jQuery(document).on('click', 'button.button[type="submit"]:contains("Schedule")', function(event) {
// Store to be used for second form.
tempStorage.email = jQuery(this).closest('form').find('input[name="email"]').val();
var fields = {
"email": tempStorage.email,
"preferredDate": '', // Keep this blank. This is a second form input.
}
});
On submission of the second form, include the first form values plus the second form values. This will overwrite the lead capture for the first form, with the second form values plus the initial first form values. This will only work if the page does not redirect or reload like in the client’s site.
jQuery(document).on('click', 'button.button[type="submit"]:contains("Reserve")', function(event) {
var fields = {
"email": tempStorage.email,
"preferredDate": jQuery(this).closest('form').find('input[name="formDateItem"]').val(),
}
});
The client is thrilled by this setup because they now have a way to filter those who submitted the first form only and up to the second form.