Form Submission and HubSpot Integration

I’m having some issues with a form on my Webflow site that is integrated with HubSpot. Here are the specific problems I’m encountering:

  1. Form Refresh and Data Loss: When a dropdown option is not selected, a popup appears indicating that required fields are not completed. After pressing “OK,” the form completely refreshes and wipes out all the entered data.
  2. Incomplete Form Submission to HubSpot: The form is being sent to HubSpot even when required fields are not filled out. This happens when someone presses submit without completing all fields.

Here’s the custom JavaScript code I’ve added to the project:


When the form is not filled correctly and the validation alert appears, pressing “OK” causes the entire form to refresh and all inputs are lost.
The form is still being submitted to HubSpot even when required fields are not filled out, leading to incomplete data being sent.

Desired Outcome:

Prevent the form from refreshing and clearing all inputs when validation fails.
Ensure the form is not submitted to HubSpot unless all required fields are correctly filled.

Any help or guidance to resolve these issues would be greatly appreciated. Thank you!

Here is my site Read-Only: Webflow - City Cave Franchise