<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Landing Page Scroll Up after Form Submitted in Blog, Website &amp; Page Publishing</title>
    <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/739522#M7809</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/89150"&gt;@TitiCuisset&lt;/a&gt;&amp;nbsp;for helping direct my inquiry, and thank you&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/452605"&gt;@crispyGTM&lt;/a&gt;&amp;nbsp; for your suggestions. I'm not a coder by nature, but I'm sure my team can implement something. In the meantime, the idea of redirecting them to a Thank You page seems like the best solution and will work just fine for our needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lori&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 16:00:21 GMT</pubDate>
    <dc:creator>LSiesto</dc:creator>
    <dc:date>2023-01-10T16:00:21Z</dc:date>
    <item>
      <title>Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/738352#M7776</link>
      <description>&lt;P&gt;I'm sure there is a way to do this. How can I force the Landing Page to scroll back to top (where the Thank You is) after a form is submitted? Please assist. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lori&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 21:24:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/738352#M7776</guid>
      <dc:creator>LSiesto</dc:creator>
      <dc:date>2023-01-06T21:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/738712#M7792</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/500013"&gt;@LSiesto&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to tag some of our experts here -&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/452605"&gt;@crispyGTM&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;&amp;nbsp;do you have some advice for&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/500013"&gt;@LSiesto&lt;/a&gt;&amp;nbsp;on this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Tiphaine&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 09:40:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/738712#M7792</guid>
      <dc:creator>TitiCuisset</dc:creator>
      <dc:date>2023-01-09T09:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/738853#M7800</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/500013"&gt;@LSiesto&lt;/a&gt;&amp;nbsp;and happy to help&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/89150"&gt;@TitiCuisset&lt;/a&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I am understanding correctly, it sounds like your form is a bit longer, so when it is submitted on the landing page and you use the option to include a message upon form submit, the message is appearing higher on the page than the portion of the page the user is seeing once submitted?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have seen this from time to time with longer forms and I haven't found an elegant way to scroll back to the top that doesn't require the user to interact in some way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a best practice, I would recommend using the "redirect to another page" option instead of the "Display an inline thank you message" because it gives you the opportunity to present relevant, helpful information related to their form submission and keep them on your website.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just my two cents - even if you use a very basic Thank You LP, I think it provides a better UX than the inline message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt;&amp;nbsp;do you know a way to make the page scroll to the top after form submit so that the top of the form area is in focus where the inline thank you message appears? I've tried a few things with JS, but it's a little outside of my technical expertise with code and thought you might have an idea &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 15:11:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/738853#M7800</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2023-01-09T15:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/739220#M7806</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/89150"&gt;@TitiCuisset&lt;/a&gt;&amp;nbsp;Thanks for the tag!&lt;BR /&gt;&lt;BR /&gt;I agree with everything that&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;,&amp;nbsp;the only other thing that comes to mind would be anchor linking to the Thank You message at the top after the form is submitted. This would take a custom code ninja but it's definitely possible.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helped to solve what you were looking for, please mark this as an accepted solution. Happy HubSpotting!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 07:18:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/739220#M7806</guid>
      <dc:creator>crispyGTM</dc:creator>
      <dc:date>2023-01-10T07:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/739522#M7809</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/89150"&gt;@TitiCuisset&lt;/a&gt;&amp;nbsp;for helping direct my inquiry, and thank you&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/452605"&gt;@crispyGTM&lt;/a&gt;&amp;nbsp; for your suggestions. I'm not a coder by nature, but I'm sure my team can implement something. In the meantime, the idea of redirecting them to a Thank You page seems like the best solution and will work just fine for our needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lori&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:00:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/739522#M7809</guid>
      <dc:creator>LSiesto</dc:creator>
      <dc:date>2023-01-10T16:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/739526#M7810</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/500013"&gt;@LSiesto&lt;/a&gt;&amp;nbsp;, I'm glad the redirect will work for now!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might also add it to the &lt;A href="https://community.hubspot.com/t5/HubSpot-Ideas/idb-p/HubSpot_Ideas" target="_blank" rel="noopener"&gt;Ideas discussion&lt;/A&gt; here as an improvement to the inline message feature. It seems like this would impact all customers and benefit everyone if the page did this automatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:03:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/739526#M7810</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2023-01-10T16:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/983595#M12388</link>
      <description>&lt;P&gt;I know it's been a while, but for others who might come accross this while hunting down solutions:&lt;BR /&gt;[From the perspective of a code ninja/monkey - (some explanation/caveats after)]&lt;BR /&gt;&lt;BR /&gt;To start, this script can be added anywhere but I've usually found it best to add it to the 'Footer HTML' section of the page settings or in a template with a locked form module as it will only work for the specified form ID.&lt;BR /&gt;&lt;BR /&gt;**You COULD generalize by simply removing the "&lt;STRONG&gt;[data-form-id="{{ formID }}]&lt;/STRONG&gt;" from the top querySelector to leave &lt;STRONG&gt;"form .hs_submit&lt;/STRONG&gt;" and swapping the bottom one to &lt;STRONG&gt;.dnd-section:has(div[&lt;SPAN class="webkit-html-attribute-name"&gt;data-hs-forms-root&lt;/SPAN&gt;="&lt;SPAN class="webkit-html-attribute-value"&gt;true&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;"])&lt;/STRONG&gt;&amp;nbsp; but if you have any other forms on the page (visible or not) this will cause an error.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;&amp;lt;script&amp;gt;
  {% set formID = '1232123212312' %} /* set to whatever your forms ID is */
  window.addEventListener('DOMContentLoaded', function() {
    setTimeout(function(){ /* Form rendered from hs side and takes an extra second to fully load - else you'll get a 'eventListener can't be called on null' error */
      document.querySelector("form[data-form-id='{{ formID }}'] .hs_submit").addEventListener('click', function(){
        /* wait a second for that form section to resize after submission so we can get the proper placement */
        setTimeout(function(){
        /* scroll to the bottom ("end") of the forms section */
          document.body.querySelector(".dnd-section:has(.hs-form-{{ formID }})").scrollIntoView({ behavior: "smooth", block: "end" });
        }, 1000); /* 1000 miliseconds of wait time here = 1 second */
      });
    }, 2000);
  });
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Next, some "justify yourself you verbose-frankencoder-fiend" explanation. This nasty &lt;EM&gt;double-timeout-even-AFTER-waiting-for-DOMContentLoaded&lt;/EM&gt; does have some rationality behind it, I swear... (though there is undoubtedly a bit of bloat)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So first off, this starts by using hubl to save the form ID for ease of use and also so we don't affect unintended forms. You can find this in the hubspot forms tool, just go to edit your form in the editor and check the url. You'll see the id --&amp;gt; forms/[your account ID]/editor/[Form Id will be here]/... If you have multiple re-occurances of the same form on the same page, you might need an extra selector class or ID on a wrapper to help further specify the target (such as "&lt;STRONG&gt;document.querySelector("#someWrapperID #form_{{ formID }} .hs&lt;/STRONG&gt;...." etc which would also need to be added inside the "&lt;STRONG&gt;:has(HERE #form_{{&lt;/STRONG&gt;..." as well).&lt;BR /&gt;&lt;BR /&gt;Next, we wait... no.. for real. The hubspot form renders separately from the rest of the dom (page content) so to avoid asking for an element that doesn't yet exists (usually computers are not fans of this), we wait 1 to 2 seconds. This is usually plenty of time so long as your page isn't some abomination of SEO with 12 prerendered 8k videos.&lt;BR /&gt;&lt;BR /&gt;Next, we add an event listener to the submission button that will wait one second (1000 miliseconds) to make sure the form submission has finished and the section has resized to accomodate the new inline thank-you text. With that ready, it then scrolls up until the END of that section is at the bottom of the screen. You could also just swap this to&amp;nbsp;&lt;STRONG&gt;block: "start"&lt;/STRONG&gt; instead to line up the top of the section to the top of the screen, but I've found that more often than not, the inability to add an offset makes the spacing tight, and this also doesn't account for any sticky headers or notification banners that will then cover up the top of the section. You &lt;STRONG&gt;could&amp;nbsp;&lt;/STRONG&gt;just add padding to the top to accomodate these, but then your being forced to reformat the page just to accomdate this. Instead, I just use the end, as the short inline thank you messages are rarely (if ever) long enough to take up the full screen height.&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;*One last disclaimer&lt;/EM&gt;: as you might have noticed, this is based on being used on using the drag and drop page editor sections, not the older template editor. But this can easily be adapted for those old template editors which have a &lt;STRONG&gt;CSS ID&amp;nbsp;&lt;/STRONG&gt;option on all of the module groups. Just add an ID (no spaces) and then replace the "&lt;STRONG&gt;.dnd-section&lt;/STRONG&gt;" in the code up above with your "&lt;STRONG&gt;#newIdOrWhatever&lt;/STRONG&gt;". Just be sure to use that leading hash '#' if its an ID or a period '.' if its a class.&lt;BR /&gt;&lt;BR /&gt;Best of Luck!&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 06:05:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/983595#M12388</guid>
      <dc:creator>DevenD</dc:creator>
      <dc:date>2024-05-29T06:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Landing Page Scroll Up after Form Submitted</title>
      <link>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/1055207#M13765</link>
      <description>&lt;P&gt;The issue is too old, but anyway i will left my fix for it.&lt;BR /&gt;&lt;BR /&gt;1. Create the anchor on the top of the form.&lt;BR /&gt;2. Add HubSpot event - onFormSubmitted and add the scroll functionality to the anchor.&lt;BR /&gt;&lt;BR /&gt;P.s. if u have fixed header, u need to change the - topPos variable.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let topPos = element.getBoundingClientRect().top + window.pageYOffset - $headerHeight;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;div id="hs-form-anchor"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;script charset="utf-8" type="text/javascript" src="source of the form"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
  hbspt.forms.create({
    region: "region-example",
    portalId: "portalId-example",
    formId: "formId-example",
    onFormSubmitted: function($form) {
        const element = document.querySelector('#hs-form-anchor');
        let topPos = element.getBoundingClientRect().top + window.pageYOffset;

        window.scrollTo({
          top: topPos,
          behavior: 'smooth'
       })
    } 
  });
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 13:25:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Blog-Website-Page-Publishing/Landing-Page-Scroll-Up-after-Form-Submitted/m-p/1055207#M13765</guid>
      <dc:creator>forb1ch</dc:creator>
      <dc:date>2024-10-15T13:25:49Z</dc:date>
    </item>
  </channel>
</rss>

