How to maintain page position after submitting form

After submitting the form on the ‘Wholesale’ page, it refreshes back to the top of the page. How can I make it so the page refreshes back to the success message on the form?
Thanks!

Site:

https://pinkelephantcoffee.myshopify.com/

password:

charis

Hello @haro_1 ,

Check after form submit what extra parameter you have. In shopify as I know each form has success or other parameters available after the form submit.

You have to write your logic with this parameter. Basically you have to write a script which will run on page load but check for the exact parameter you have in the URL if found scroll down the page to the specific div else it will do nothing.

I hope this will give you an idea.
Thanks

Go to your Online store > Themes > Edit code > open file of form that you are using on your Wholesale page, find this line of code

{%- if form.posted_successfully? -%}

Then add this code below


Hmm, thank you for the suggestion, it works, but now the success message doesn’t appear.
The link I inserted is an anchor link to the form, could that be the issue?
This is how I’ve included that code:

{% if form.posted_successfully? %}
    

      {{ 'contact.form.success' | t }}
    

     
    
  {% endif %}