Contact Form loads 2 extra forms
-
Hello,
on our website the contact form sometimes loads 2 extra forms within the content. Sometimes it displays the right form, sometimes 3 forms.
What could be the issue?
The page I need help with: [log in to see the link]
-
Hi @mad2kx , Thanks for your message
Could you tell me how are you adding the forms to the page?
I see you are using Elementor, are you using the shortcode widget?You can also send a screenshot to [email protected]
Best regards,
Arthur
Greetings, we are having the same problem, since last friday i think. All Plugins are up-to-date and the only solution is to replace all shortcodes with the javascript widget code.
As a side note, inside elementor the short code preview works fine and only one form is printed. The javascript embedded code works also fine
We tried every possible solution…
Hi @support5d Do you have any Server Side rendering in place?
What I can see is that the shortcode is being called without a valid target element, so its creating a new element container for it.
Could you try adding
if ( empty( $form_div_uuid ) ) { return ''; }
to https://plugins.svn.www.ads-software.com/leadin/trunk/src/class-pagehooks.php after line 175 in your plugin editor to see if this fix the problem
If this works we can them have this added
Let me know if this helps
-
This reply was modified 2 years, 8 months ago by
harthur90. Reason: spelling
Hey @harthur90 i addded the code and a var_dump before the switch clause… the var_dump was only posted on the first form and not repeatedly
i removed line 27 and the raw shortcode was only printed once
i added a console.log() in line 190 and it printed 3 times the form_div_uuid (the console.log() is still enabled for debugging)
i played around with echo, ob_start() + return ob_get_clean()… nothing seems to work…
(oh as a side note, on friday it only showed 2 forms… now there are 3 printed… black magic…)
-
This reply was modified 2 years, 8 months ago by
support5d.
Hey @harthur90 i could pinpoint the problem… we have 2 popups with hubspot shortcode forms in it… these are rendered & added invisible on all page loads
so the other 2 shown forms are different ones… the problem should not be the shortcode rendering but more a javascript problem, cause the 2 other divs are invisible
press the “Contact us” Button in the footer and it renders correctly a fourth form… which is the same code like the first duplicate one. Both duplicate forms are not using the $form_div_uuid as the javascript target.. so it is probably a javascript form rendering fallback when the html target is not found…
Wrong: hbspt-form-e0fdeb79-f0af-48a3-9455-d9c033003a5a (UUID from the id)
Wrong: hbspt-form-a4601138-f5a3-4ce7-b438-7c47f443db96 (UUID from the id)
Correct: hbspt-form-1656346333000-2111172195 (using the numeric $form_div_uuid)i created a small quick fix to hide the wrong forms, until the bug is somehow fixed or the plugin is updated. it replaces the return code in line 176 and IS NOT A PERMANENT FIX it adds a div container around the shortcode and hides all .hbspt-form besided the orignal one, which has the class .this_is_the_correct_form
return <div class="hide_duplicate_forms_inside_this_div"> <style> .hide_duplicate_forms_inside_this_div .hbspt-form { display: none; } .hide_duplicate_forms_inside_this_div .this_is_the_correct_form{ display: block !important; } </style> <script> window.hsFormsOnReady = window.hsFormsOnReady || []; window.hsFormsOnReady.push(()=>{ hbspt.forms.create({ portalId: ' . $portal_id . ', formId: "' . $id . '", target: "#hbspt-form-' . $form_div_uuid . '", region: "' . $hublet . '", ' . LeadinFilters::get_leadin_forms_payload() . ' })}); console.log("type: ' . $type . '"); console.log("portal_id: ' . $portal_id . '"); console.log("id: ' . $id . '"); console.log("form_div_uuid: ' . $form_div_uuid . '"); </script> <div class="hbspt-form this_is_the_correct_form" id="hbspt-form-' . $form_div_uuid . '"></div></div>';
PS: I found another customer with the same bug… there is single elementor popup in the background so there are only 2 forms printed not 3
https://www.gqs-akademie.com/download-schulungskatalog/-
This reply was modified 2 years, 8 months ago by
support5d.
-
This reply was modified 2 years, 8 months ago by
support5d.
-
This reply was modified 2 years, 8 months ago by
support5d.
-
This reply was modified 2 years, 8 months ago by
support5d.
-
This reply was modified 2 years, 8 months ago by
support5d.
-
This reply was modified 2 years, 8 months ago by
support5d.
-
This reply was modified 2 years, 8 months ago by
support5d.
We are having the same issue on our website as well. We use Elementor and the shortcode widget. If we have a webpage with multiple forms, all the forms are displayed in each shortcode widget. I’ve rolled back to the previous version of the Hubspot plugin until this issue is resolved.
Where can I download the older version of the plugin?
Hi @mad2kx , can you send us a email at [email protected] so we can send you the older version of the plugin
@support5d Thanks for all the detailed investigation you did! I’ve also come into the same conclusion. I believe if you add a surround logic to the javascript it may fix the problem
return ' <script> window.hsFormsOnReady = window.hsFormsOnReady || []; window.hsFormsOnReady.push(()=>{ var element = document.querySelector("#hbspt-form-' . $form_div_uuid . '"); if(element){ hbspt.forms.create({ portalId: ' . $portal_id . ', formId: "' . $id . '", target: "#hbspt-form-' . $form_div_uuid . '", region: "' . $hublet . '", ' . LeadinFilters::get_leadin_forms_payload() . ' }); } }); </script> <div class="hbspt-form" id="hbspt-form-' . $form_div_uuid . '"></div>';
Could you try this as a permanent solution so I can add to our plugin?
Best regards
-
This reply was modified 2 years, 8 months ago by
harthur90. Reason: code format
@harthur90 did not help, it is more a problem in the hubspot form js script. It adds all missing form container… just try and remove the div container, the js script adds a fall back div container and renders the form in it
<div class="hbspt-form" id="hbspt-form-' . $form_div_uuid . '"></div>
-
This reply was modified 2 years, 8 months ago by
support5d.
We’ll work on a solution and let you know once its fixed.
Thanks for all the information provided
Hi y’all, hope you are having a nice week and sorry for the delay.
We’ve just released our Elementor widgets support so users can have an easy to use way to add Hubspot forms to their pages.
I’m closing this issue as its been addressed by this new widget. Please let me know if this works for you.
Best regards,
-
This reply was modified 2 years, 8 months ago by
- The topic ‘Contact Form loads 2 extra forms’ is closed to new replies.