PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Changing tab index

  1. I have got 2 forms on 1 page and if you start to fill out the 1st form and use the tab key to change fields, it alternates between the 2 forms eg. you're in 1st field on form 1, tab takes you to 1st field in form 2, then 2nd field in form 1, then 2nd field in form 2 etc...

    How can I change the tab index on these forms to prevent this from happening?

    Thanks, Adrian

    Posted 12 years ago on Friday September 16, 2011 | Permalink
  2. Have just added:

    <?php
    add_filter("gform_tabindex_4", create_function("", "return 10;"));
    ?>

    in to my themes functions.php as advised by one of your documentations but this did not work.

    Any help appreciated

    Posted 12 years ago on Friday September 16, 2011 | Permalink
  3. Quick question.. is one of your forms added via the Gravity Forms widget? If so, you can set the tabindex in the widget options on the widget page and that might be easier for you.

    screenshot: http://bit.ly/ox72Cn

    Posted 12 years ago on Friday September 16, 2011 | Permalink
  4. Hi Kevin,
    No I wasnt aware of the widget, I added them from the little forms icon when adding the new post.
    How can I change the tab index without the widget?
    Thanks

    Posted 12 years ago on Friday September 16, 2011 | Permalink
  5. If you have inserted two forms into one post or page, the widget will not help you. If you have two forms on one URL of your site (one in a footer or sidebar widget, one in the actual page or post) then you can use Kevin's solution to reset the tabindex for your form in the widget. It's easier than using the function call.

    Can you post a link to your page with two forms in it? You're using the proper function if you want to set the tabindex for form 4 to begin at 10.

    Posted 12 years ago on Friday September 16, 2011 | Permalink
  6. Hi Chris, yes the 2 forms are both in my post so I did think that was the correct code but I pasted it in to functions.php and it did not do anything.

    The page is http://www.primarycarecommunity.net/vacancies

    Thanks, Adrian

    Posted 12 years ago on Friday September 16, 2011 | Permalink
  7. It looks like everything is correct. You have form 5 first then form 4 second. Tabindexes are 1 through 9 for form 5, so starting at 10 should be fine for the second form, form 4.

    I inserted form 5 and 4 into this page, then used your code (but changed my tabindex to 44 since I had more fields in form 5):

    http://gravity.chrishajer.com/two-forms-one-page/

    [php]
    add_filter("gform_tabindex_4", create_function("", "return 44;"));

    Are you sure it's in the functions.php in your current theme folder?
    http://www.primarycarecommunity.net/wp-content/themes/pcc/functions.php

    Also, is it in an area of functions.php that will be processed (not nested inside another block of code, or a comment maybe)?

    If it looks OK, please send me your functions.php via email to chris@rocketgenius.com and I'll see if I can figure it out.

    Posted 12 years ago on Saturday September 17, 2011 | Permalink
  8. Hi Chris, I have just tried pasting it in to different parts of the file and have finally got this going, thanks for your help, you guys are awesome!

    Posted 12 years ago on Saturday September 17, 2011 | Permalink
  9. Glad to hear it. Congratulations.

    Posted 12 years ago on Saturday September 17, 2011 | Permalink

This topic has been resolved and has been closed to new replies.