delphi
delphi

Reputation: 11115

Bug in rails with select input?

Tabindex does not work on select when using Rails. Is this a bug or am I just slow? I used "the Google" but that didn't turn up any answers, just people with similar questions.

<%= p.label :sector, "Sector" %>
<%= p.select :sector, [["Technology","tech"],["Healthcare","health"]], { :tabindex => 1 } %>        

(I tried hacking this by putting the tabIndex on the label, but Chrome as an example doesn't seem to pick that up even when the output has a label "for" that matches the id of the select.)

Upvotes: 1

Views: 914

Answers (1)

smathy
smathy

Reputation: 27961

select (as you have it) accepts four arguments, the method, the choices, a hash for the select options, then a hash for the html attributes. You've put the html attribute hash in position 3 instead of position 4. Instad you want to pass in an empty hash in position 3, and your tabindex in position 4, ie.

f.select :selector, [[other, things]], {}, { :tabindex => 1 }

Upvotes: 4

Related Questions