Hello @JRivera-Salva
I’ve noticed that the form sometimes loads correctly and sometimes not. How do you load the custom code for creating the steps? I suspect the problem is that HubSpot Forms are being loaded with JavaScript, and sometimes the form isn’t fully loaded on your page when your custom function runs.
To address this, ensure that the form is fully loaded on your page before running your custom code to create the steps.
You can achieve this using the HubSpot form custom events: HubSpot Global Form Events.
In your case you need the onFormReady event. You should wrap your custom code with this If statement:
window.addEventListener('message', event => {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady) {
// YOUR CUSTOM CODE FOR CREATING STEPS
}
});
You could also implement some kind of placeholder or loading spinner to avoid massive page shifting while loading and creating the multistep form.
Hope this helps.
Regards,
Gracjan