2016-08-23 24 views
0

我試圖做到的,是這樣的在軌是否rails不支持輸入標籤上的html列表屬性?

https://jsfiddle.net/uxc45hcs/

但軌道似乎並不支持HTML屬性「列表」

.col-md-2.execute_at_input = f.input :execute_at, label: "Execute Attt", placeholder: " In Minutes ", list: 'listid' 

上面的代碼輸出下面的:

<input class="string optional form-control" placeholder=" In Minutes " type="text" value="" name="execute_at" data-validate="true"> 

在哪裏,因爲它應該是:

<input class="string optional form-control" placeholder=" In Minutes " type="text" value="" name="execute_at" data-validate="true" list="listid"> 

我做錯了什麼?

回答

1

像這樣的東西應該工作:(在軌5測試)

<%= f.text_field :name, :class => 'form-control col-md-2', :placeholder => 'In Minutes', :list => "listid" %>

1

這適用於text_field

.col-md-2.execute_at_input= f.text_field :execute_at, label: "Execute Attt", placeholder: " In Minutes ", list: 'listid' 

這導致下面的輸出

<div class="col-md-2 execute_at_input"> 
    <input id="execute_at" label="Execute Attt" list="listid" name="execute_at" placeholder=" In Minutes " size="30" type="text" maxlength="255"> 
</div> 

如果您正在使用Formtastic檢查語法