Disabling Automatic Scrolling On Form Confirmations

Summary

When an AJAX enabled form or a multi-paged form is submitted, the default behavior of Gravity Forms is to scroll to the confirmation message. In most cases, this is the desired behavior, but in a few scenarios, you may want to disable this functionality.

Use the gform_confirmation_anchor Filter

Gravity Forms makes it incredibly easy to remove this functionality by providing an easy-to-use filter.

Disabling Automatic Scrolling On a Specific Form

To disable automatic scrolling on a specific form, use the gform_confirmation_anchor filter like so, replacing # with the form ID:

add_filter( 'gform_confirmation_anchor_#', '__return_false' );

Disabling Automatic Scrolling On All Forms

Disabling automatic scrolling on all forms is just as easy as disabling it on a specific form. Use the filter like the following:

add_filter( 'gform_confirmation_anchor', '__return_false' );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?