Do something with Campaign Web Form before POST submission to infusionsoft

Okay, sometimes I just have to ask myself the right question to figure something out. I’m still learning. Apparently, onSubmit in the form tag will supersede the POST. I have only ever handled form submits through jquery before so this feels pretty elementary.

Hopefully my errors will show somebody else the way.

Solution is to add onSubmit=“return validateInfusionForm()” to your form tag.

function validateInfusionForm()
{
	let infusionForm = $('.infusion-form');
	infusionForm.form({
		fields: {
            'inf_field_FirstName': 'empty',
            'inf_field_Email': 'empty',
        },
	});
	
	if (infusionForm.form('is valid')) {
		return true;
    } else {
        infusionForm.form('validate form');
		return false;
    }
}