By Neil on August 25, 2015
Like a lot of people I use Gravity Forms in my WordPress website for all sorts of things. Mainly newsletter signup forms but also contact forms.
Click here if you want to know more about Gravity Forms.
If you are experiencing problems when using the TAB key with your Gravity Form then this will hopefully help you out. I noticed that when I hit the TAB key on my keyboard when filling out a Gravity Form on my website that the cursor did not jump to the next field as you’d expect, instead it jumped to a completely different form on the page, and then to the toolbar on my website. This was not good and affects the user experience on my website.
Gravity Forms knows of this issue and states that it is fixed in new versions of their forms software. However I still have this issue. Maybe a recent WordPress update made it happen again?
Anyway, I solved this by pasting the code below into the WordPress child themes functions.php file. Just watch the video if you don’t know how to do this.
Code for functions.php file – just copy & paste at the very bottom.
add_filter( ‘gform_tabindex’, ‘gform_tabindexer’, 10, 2 );
function gform_tabindexer( $tab_index, $form = false ) {
$starting_index = 1000; // if you need a higher tabindex, update this number
if( $form )
add_filter( ‘gform_tabindex_’ . $form[‘id’], ‘gform_tabindexer’ );
return GFCommon::$tab_index >= $starting_index ? GFCommon::$tab_index : $starting_index;
}
Leave a Reply