skip to Main Content

I’ve got a problem. I’m currently working for a client in an WordPress buildup with Elementor. They have a form made with GravityForms.

When I submit the form it automaticly scrolls to top. I want it to do nothing more than submit the form. So… no scrolling.

I found out I can ‘easy’ set it off. But it won’t work over here

https://docs.gravityforms.com/disable-automatic-scroll-form-confirmation/

On some other websites I found they said ‘Place it in the functions.php’.

So I did, I had no idea where specific in the fuctions.php… but It didn’t work on top neither on the bottom.

Other websites told me to work in the theme files (since there is no theme because I’m using Elementor I can’t find where…

The docs.gravityforms.com told me to paste it in form_display.php…

Whatever… Where ever I post the ‘easy’ line of code. It wont work…

Can somebody please help me out.
Where specefic do I have the place this line of code

add_filter( ‘gform_confirmation_anchor’, ‘__return_false’ );

Thanks in advance!!!

2

Answers


  1. functions.php is a Theme File that you cam Access From WordPress Dashboard>> Apperence>> Theme Editor >> and now look for the right panel http://prntscr.com/prb6v2

    After opening the functions.php file put that line of code at the bottom of it & Save.

    However, It’s recommended to do such Theme file edit via child theme otherwise you will lose your edit’s after next theme update.

    Login or Signup to reply.
  2. That link and snippet at https://docs.gravityforms.com/disable-automatic-scroll-form-confirmation/ is to prevent the confirmation message appear in the viewport. On submission the form displays the confirmation message above the position where the start of the form would have been. Years ago, the default behaviour was that after a long form, you could submit and be way down the viewport and miss the confirmation message.

    This this snippet used to be a way for getting around this and would jump you back up the viewport. But now "When a form is submitted, the default behaviour of Gravity Forms is to scroll to the confirmation message"

    So it look like this snippet is now used to prevent the old behaviour, so you’re in the right place.

    I would use a child them and add the code to the child theme functions.php file, otherwise it may get overwritten when the parent theme is updated.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search