Hi,
I was trying to change the form embedded including an event when the form is sent.
I made this code, but I crashed the form.
I have no idea what could be happening. Is there any problem with the onForm?
Thanks in advance
Hi,
I was trying to change the form embedded including an event when the form is sent.
I made this code, but I crashed the form.
I have no idea what could be happening. Is there any problem with the onForm?
Thanks in advance
Hi @Vivian,
Are you using onFormSubmit per this article?
This method should work. If you’re still encountering issues, please include the modified embed code below.
Hi @Isaac_Takushi
I used it. I planned like this:
hbspt.forms.create({
portalId: “-----”,
formId: “--------------------”,
onFormSubmit: function($form) {
analytics.track(‘form send’, {
category: ‘Send’,
label: ‘send contact’
}
)};,
target: ‘.formPst’,
onFormSubmit: function() {
window.dataLayer.push({
event: ‘lead_conversion’+window.location.pathname.split(///i).join(‘_’),
formId: ‘--------------------’
});
}
});
// ]]>
Hi @Vivian,
My test form breaks as well when I place two instances of onFormSubmit in the embed code. If you add the second function within the first onFormSubmit, does it work?