Quantcast
Channel: Snippets Archives - Gravity Wiz
Viewing all articles
Browse latest Browse all 196

Fix Gravity Form Tabindex Conflicts

$
0
0
Avoid the annoying issue where tabbing from a field in one form tabs you to a field in another form. This is caused by conflicting tab indexes.

This is most common when loading a Gravity Form on a page which is loading a non-GF form (like the WordPress comment form). You’re typing away on your Gravity Form and tab to the next field. Awesome. Except the next field is a completely different form. This snippet sets the starting index of your Gravity Form inputs ridiculously high so such conflicts never happen again.

1 2 3 4 5 6 7 8 9 10
<?php
/**
* Fix Gravity Form Tabindex Conflicts
* http://gravitywiz.com
*/
add_filter("gform_tabindex", "gform_tabindexer");
function gform_tabindexer() {
$starting_index = 1000; // if you need a higher tabindex, update this number
return GFCommon::$tab_index >= $starting_index ? GFCommon::$tab_index : $starting_index;
}
view raw gistfile1.php This Gist brought to you by GitHub.

How do I install this snippet?

Easy peasy. Just copy and paste the code above into your theme's functions.php file.

How to I use this functionality?

This snippet is plug-n-play. No changes needed (unless you’re still seeing tabindex conflicts which is highly unlikely). If you are, just update the 1000 in the snippet to a higher number until the conflict disappears.


Viewing all articles
Browse latest Browse all 196

Trending Articles