You’re mixing HubSpot’s native form handling with jQuery validation, which creates conflicts. Skip submitHandler and use HubSpot’s onBeforeFormSubmit callback instead - it works much better since it hooks directly into HubSpot’s form lifecycle. Set up your validation rules in onBeforeFormSubmit and return false when validation fails. This stops the form from submitting to HubSpot entirely. You can trigger jQuery validation manually with the valid() method and only allow submission if it returns true. Couple other issues: you’re referencing updatedForm before declaring it, which will throw an error and break everything. Also, your errorPlacement function is empty, so users won’t see any validation messages. Either add actual error display logic or remove it to use jQuery’s default error placement.
Had the same problem with HubSpot forms and jQuery validation. Your issue is calling formElement.submit() right after event.preventDefault() - that just cancels out what you’re trying to do. You need to handle HubSpot’s form submission through their API instead. Use onBeforeFormSubmit in your HubSpot config rather than jQuery’s submitHandler. This callback fires before HubSpot processes anything, and you can return false to stop it. Run your jQuery validation manually with jQuery('#your-form').valid() inside this callback, then only return true if it passes. Also, you’re using updatedForm before declaring it. Move that var updatedForm line up above where you first use it. And check your errorPlacement function - if it’s not actually doing something with the errorMsg parameter, users won’t see what went wrong.