Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 71065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:49:45+00:00 2026-05-10T19:49:45+00:00

Is there an easy way to have the form helpers set the tabindex parameter

  • 0

Is there an easy way to have the form helpers set the tabindex parameter automatically when using form helpers in Rails?

Basically, I don’t want to have to manually set the tab index on every form element when building forms (I keep forgetting to update them when I change things). The majority of the forms I write are basically a list of fields. The tab index should be in the order they are defined. Ideally, I would set the initial index in the form_for call and everything else would be handled for me.

Does anyone know how to do this?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:49:46+00:00Added an answer on May 10, 2026 at 7:49 pm

    I usually add a method like this to ApplicationHelper

    def autotab   @current_tab ||= 0   @current_tab += 1 end 

    Then in my views I make calls to the helper with a :tabindex => autotab like so:

    <%= text_field 'post', 'login',:tabindex => autotab, :value => @login %> 

    You can also modify all the text_field, check_box, methods one at a time to add the tabindex automatically, by adding something like this to your application helper: (untested but you get the point)

    def text_field_with_tabindex(*args)   options = args.last   options[:tabindex] = autotab if options.is_a?(Hash) && options[:tabindex].nil?    text_field_without_tabindex(*args) end  def self.included(base)   base.class_eval do     alias_method_chain :text_field, :tabindex   end end 

    That might be more trouble than it’s worth

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a easy way to do this? Or do I have to parse
Is there an easy way to unroll the stack in Tcl? I have this
I have a row of data in dict format. Is there an easy way
I have a workbook with 20 different pivot tables. Is there any easy way
If I have the string .....ZZ..ZZ..... or .Z.1.Z.23Z.4.Z55 , Is there an easy way
I am sure there is no easy way to do this but I have
I was wondering, is there any easy way to have the html generated by
Is there an easy way to allow for required profile fields? I am using
Is there an easy way to a Settings.bundle style form in an app? I
Is there an easy way to determine the size of a Form it does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.