問題:我不知道爲什麼我的輸入文本框有固定的寬度(太小所以它不適合屏幕),我不能改變大小以適當的方式。任何人都可以幫我找到是什麼原因造成的?Textarea大小與Bootstrap-Sass和Formtastic問題
在我的形式分:
<%= semantic_form_for @post do |f| %>
<%= f.inputs do %>
<%= f.input :name, :input_html => { :size => 10000 } %>
<%= f.input :content, :input_html => {:size => 100000 } %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :button %>
<%= f.action :cancel, :as => :link %>
<% end %>
<% end %>
更新:我發現
<%= f.input :name, :input_html => { :style => "width: 80%" } %>
成功地改變了textarea的大小。
新問題:爲什麼
<%= f.input :content, :input_html => {:size => 100000 } %>
無法工作?
要添加一個問題.. 當用戶登錄時,我想簡單地將他的名稱傳遞給:name符號。所以我想將其設置爲隱藏在條件輸入類型,但我不知道該formtastic語法在這種情況下是如何工作的?我想:
<%= f.input :name, :as => hidden, :name => <%= current_user.name %> %>
而且我也試過只是擺脫輸入區域名稱變量,並設置
<% @post.name = current_user.name %>
但隨着這就是問題所在,這種方式沒有通過要求輸入名稱是存在的驗證檢查。
這兩個嘗試都失敗了。有沒有人可以給我答案1)文本框大小問題和2)獲取輸入問題?
嘗試添加'f.input:content,:input_html => {row:10,column:1000}' – Thanh
只有另一個寬度與上面相同的文本框。 –