I started noticing a problem on a number of my Gravity Forms where if I was on the first field and pressed Tab, it would take me to a different area of the webpage and not to the next field. As someone who is accustomed to quickly filling out forms by pressing the tab key, this created a problem. The good news is that it is an easy fix.
Using an FTP manager or the WordPress Editor (Appearance > Editor), go to your functions.php file and add this code to the bottom of the file:
<?php add_filter("gform_tabindex", create_function("", "return 4;")); ?>
If a specific form is acting up for you, you can add code specific to that form. Find the Form ID number by clicking ‘Forms’ in the menu. To the left of your list of forms, you will find the ID per form. Replace the ‘5’ in the code below with the Form ID number.
<?php add_filter("gform_tabindex_5", create_function("", "return 4;"));?>
Test it out on your site to make sure it is working. Also, open up your WordPress admin area. Once I added the code, I noticed some error messages at the top of the screen in the WordPress admin area. I had to place the code in a different area of my functions.php file for it to work properly without the error codes.
Update: Forms in Widgets
Additionally, if one of your forms is in a widget, you can update the tab index within the widget area. After you add a Gravity forms widget to the page, click on the ‘advanced settings’ area and you can put in a number in the tab index area. If this form is the second form on your page (for instance, if it is in the footer and the other form is in the main content of the page, choose a number that is higher than the number of fields in your first form. It can even be much higher just to make sure the tab index works properly.
To test this out, go to the first form on your page. Enter info into the first field and then press tab to go to the next fields. It should go right in order.
I was having the same issue and it was so bothersome. This worked like a dream! Thanks so much.
Hello Brock – glad I could help.
Oops. I did as instructed above and now I get this error:
Parse error: syntax error, unexpected ‘<' in /var/www/vhosts/biqed.com/httpdocs/wp-content/themes/i-excel/functions.php on line 782
And my site is now down as well as my dashboard from which I access the editor. Be careful out there.
Hi,
I used this code, and it worked.
But there is a problem that there are two forms in one page, and after this code when I press tab after first field it takes me to the second field of other form, and continue to change forms like this.
I just used this code and it completely crashed my site – can’t load the site or anything! Not sure if this is a scam or just incompetence, but DON”T FOLLOW THIS ADVICE.
Hi Stephen – this may be out of date. Here is an updated way to change the tab index – http://wpdecoder.com/plugins/gravity-forms-not-tabbing-right-heres-the-fix/
Thanks for the snippet! Good job
Thanks
Awesome tutorial thank you! The second coding option worked a charm, thanks again!