[英]Ruby on Rails: simple_form + Twitter Bootstrap not showing up
[英]how to make simple_form work with twitter-bootstrap-rails; form in general in bootstrap
1)如何使用簡單的表單和twitter-bootstrap-rails構建表單,以便它們顯示很酷的引導程序樣式驗證錯誤?
2)如何在twitter-bootstrap-rails中構建表單,以便它們顯示很酷的引導程序樣式驗證錯誤?
3)我嘗試使用simple_form構建表單。 但驗證未顯示任何錯誤消息。 我正在嘗試添加由Devise
生成的用戶模型和表單的驗證
Techs:Rails 3.2.7.rc1,1.9.2,twitter-ootstrap-rails 2.1.1,simple-form 2.0.2
碼:
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'form-vertical' }) do |f| %>
<%= f.error_notification %>
<%= f.input :fname, :placeholder=>"First name", :input_html => { :class => "enroll_input span4"} %>
<%= f.input :lname, :placeholder=>"Last name", :input_html => { :class => "enroll_input span4"} %>
<%= f.input :email,:placeholder=>"Email",:input_html => { :class => "enroll_input span4"} %>
<%= f.input :password, :placeholder=>"Password",:input_html => { :class => "enroll_input span4"} %>
<div class="enroll_button"> <%= f.submit " Enroll ", :class=>"btn btn-primary pull-right btn-large" %></div>
<% end %>
我不確定,如果這不起作用或jquery
不起作用。
試試這個:
<%= f.input :email do %>
<%= f.input_field :email %>
<% end %>
在這里,您可以找到關於兩個示例應用程序,實時應用程序集成的說明:
https://github.com/plataformatec/simple_form/#twitter-bootstrap
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.