This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
After a form is submitted, it scrolls to the success message or first error message. With some themes, this may be underneath a floating header or otherwise misplaced. Use this hook to add extra offset to the scrolling.
Usage
add_filter('frm_scroll_offset', 'frm_scroll_offset');
Parameters
- None
Examples
Offset Autoscroll
add_filter('frm_scroll_offset', 'frm_scroll_offset');
function frm_scroll_offset(){
return 170; //adjust this as needed
}
Disable Autoscroll
add_filter('frm_scroll_offset', 'frm_scroll_offset');
function frm_scroll_offset(){
return -1; //this will disable the autoscroll
}
If you want to disable the automatic scrolling to required fields that is triggered by browsers, you can use the frm_focus_first_error filter.