[英]Rails date_select and tabIndex
嘗試為 date_select 設置 tabIndex 已被證明很難開箱即用。
<%= f.date_select :card_expires_on,
{:order => [:month, :year], :discard_day => true, :start_year => Date.today.year,
:end_year => (Date.today.year+10), :add_month_numbers => true},
{:tabindex => "11"} %>
這是我想出的最好的方法,但是對於兩個 select 下拉菜單,這會將 tabIndex 設置為 11。 如何將月份的tabIndex設置為11,將年份的tabIndex設置為12?
您不能使用標准的date_select
幫助程序,所有 html 選項都會傳遞給DateTimeSelector
class,它使用這些 html 選項為每個字段創建下拉菜單。
您可以修改此 class 以執行您需要的操作(如果 rails3,請參閱操作包中的 date_helper.rb),或者您可以編寫自己的 date_select 來執行此操作等。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.