Forms on Safari not creating Contact in CRM

Hey @EmmaT ! Tom here from the HubSpot forms team.

I just took a look at the form you have linked on your page here: https://form.gethousesurvey.ie/buyer-form

It looks like you are using a customised version of our forms embed code which uses our “onFormSubmit” function as outlined here:

https://developers.hubspot.com/docs/methods/forms/advanced_form_options

When this runs the custom script within your page is using the JavaScript “window.location” object which changes the url of the page. This runs when the “onFormSubmit” function runs. From the doc linked:

"Callback that executes after form is validated, just before the data is actually sent. "

This means that it’s possible for the custom code in here to run and change the URL of the page before our form actually has the opportunity to submit the data to us. It sounds like safari is likely constantly running this prior to the submission happening.

You may need to consult your developer who customised this embed code to review this and ensure that no changes to this will affect any integrations or your page in unexpected ways. However, I’d recomend changing the “onFormSubmit” function to “onFormSubmitted” as outlined in this doc:

https://developers.hubspot.com/docs/methods/forms/advanced_form_options

“onFormSubmitted” is similar to the callback you have however the important disctinction is that this runs *after* the form has submit data to HubSpot and not before. This would ensure all of your submissions are entered to HubSpot without issue before your custom code is run.

I hope this helps! :slightly_smiling_face: