getfluid
3/9/2018 - 7:25 PM

Gravity Forms anchor to certain part of page on submit

Gravity Forms anchor to certain part of page on submit

/**
*
* add to functions.php
*
* when contact form page sumbits, scroll to point on page
* '_ID' can be appended to 'gform_confirmation_anchor' in order to target a certain form. replace ID with the form's ID
* '200' is the number of pixels to offset from the top of the form's container to top of the page
* eg: 200 would anchor 200px above form's container on sumbit
*/

add_filter( 'gform_confirmation_anchor', function() {
    return 200;
} );

/**
* To disable from GF from scrolling anywhere after ajax submit, use this instead
* again, '1' denotes the form's ID
* use 'gform_confirmation_anchor' to target all forms
**/

add_filter('gform_confirmation_anchor_1', '__return_false');