gpt4 book ai didi

ruby-on-rails - rails : Simpleform inside of table input type = text_area- how to set its height?

转载 作者:数据小太阳 更新时间:2023-10-29 08:39:56 28 4
gpt4 key购买 nike

我正在为我的 Rails 应用程序使用“Simpleform”gem,并且我在表格中嵌入了一个表单。

表单的元素之一是文本区域。但是,由于这种输入类型,表格的整行很高。我想设置它的高度,使行不是那么高。

我该怎么做我尝试了以下但似乎没有任何改变

 <% @listings.each do |listing| %>  
<%= simple_form_for(listing, :html => {:multipart => true, :class=> '.form-inline'} ) do |f| %>
<tr>
<td><%= listing.id %></td>
<td><%= listing.name %></td>
<td><%= f.input :telephone %></td>
<td><%= f.input :fax %></td>
<td><%= f.input :suite %></td>

<td> <%= f.input :notes, :size => 5 %></td>
<td> <%= f.button :submit %></td>
</tr>
<% end %>
<% end %>

如有任何建议,我们将不胜感激

最佳答案

我想你想要这样的东西:

<td> <%= f.input :notes, :input_html => { :rows => 5 } %></td>

input_html 选项将任意属性添加到生成的 HTML 标记中。对于文本区域,没有“大小”属性,只有“列”或“行”。

我自己没有测试过,但我已经将 :input_html 用于其他 HTML 属性。让我知道你过得怎么样!

关于ruby-on-rails - rails : Simpleform inside of table input type = text_area- how to set its height?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11024130/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com