1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
<h3>Horizontal Form</h3>
<%= form_with_source do %>
<%= bootstrap_form_with model: @user, layout: :horizontal, local: true do |form| %>
<%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %>
<%= form.password_field :password, placeholder: "Password" %>
<%= form.select :status, [['activated', 1], ['blocked', 2]], prompt: "Please Select" %>
<%= form.text_area :misc %>
<%= form.check_box :terms, label: "Agree to Terms" %>
<%= form.collection_check_boxes :misc, @collection, :id, :street %>
<%= form.collection_radio_buttons :misc, @collection, :id, :street %>
<%= form.file_field :misc %>
<%= form.datetime_select :misc, include_blank: true %>
<%= form.submit %>
<% end %>
<% end %>
<h3>With Validation Error</h3>
<%= form_with_source do %>
<%= bootstrap_form_for @user_with_error, layout: :horizontal do |form| %>
<%= form.alert_message "This is an alert" %>
<%= form.error_summary %>
<%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %>
<%= form.collection_check_boxes :misc, @collection, :id, :street %>
<%= form.submit %>
<% end %>
<% end %>
<h3>Inline Form</h3>
<%= form_with_source do %>
<%= bootstrap_form_for @user, layout: :inline do |form| %>
<%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %>
<%= form.password_field :password, placeholder: "Password" %>
<%= form.check_box :terms, label: "Agree to Terms" %>
<%= form.collection_check_boxes :misc, @collection, :id, :street %>
<%= form.submit %>
<% end %>
<% end %>
<h3>Simple</h3>
<%= form_with_source do %>
<%= bootstrap_form_for @user, url: "/" do |form| %>
<%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else" %>
<%= form.password_field :password, placeholder: "Password" %>
<%= form.check_box :terms, label: "Agree to Terms" %>
<%= form.collection_check_boxes :misc, @collection, :id, :street %>
<%= form.rich_text_area(:life_story) if Rails::VERSION::STRING > "6" %>
<%= form.submit %>
<% end %>
<% end %>
|