Disabling Automatic Scrolling On Form Confirmations

Disabling Automatic Scrolling On Form Confirmations

Use the gform_confirmation_anchor FilterDisabling Automatic Scrolling On a Specific FormDisabling Automatic Scrolling On All Forms

When a form is submitted, the default behavior of Gravity Forms is to scroll to the confirmation message. In the vast majority of 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.
This filter will be used either within its own plugin (ideally) or within your theme』s functions.php file.
Note: Placing modifications within your own plugin is recommended simply because it makes your changes immune to theme updates. If placed within your theme, your changes could be overwritten by theme updates.
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' );

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注