You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It follows Bootstrap's convention of adding the .error class to the .control-group fieldset and overrides Rail's default error wrapping behavior. It does not conflict with ActionView::Base.field_error_proc so non-bootstrap forms function normally.
This gem seems like a good home for a bootstrap form builder so I thought I would share what I have if you wish to use it as a starting point. It obviously is very basic and needs refinement but it gets the job done.
<%= bootstrap_form_for @user, html: {class: 'form-horizontal'} do |f| %>
<legend>Create an Account</legend>
<%= f.control_group :email do %>
<%= f.email_field :email %>
<% end %>
<%= f.control_group :password do %>
<%= f.text_field :password %>
<p class="help-block">Must be at least 6 characters</p>
<% end %>
<%= f.control_group :full_name do %>
<%= f.text_field :full_name %>
<% end %>
<%= field_set_tag nil, class: 'form-actions' do %>
<%= button_tag 'Create account', type: 'submit', class: 'btn primary' %>
<%= link_to 'Cancel', root_path %>
<% end %>
<% end %>
The text was updated successfully, but these errors were encountered:
Thanks for your contribution. It looks like good starting point so I urgently need a robust Formbuilder (for themed generator). I'll implement that (watching gist) if I can catch some free time.
I wrote a bootstrap_form_for builder that outputs HTML for use with Bootstrap 2.0's .form-horizontal or .form-vertical styles.
https://gist.github.com/1695087
It follows Bootstrap's convention of adding the .error class to the .control-group fieldset and overrides Rail's default error wrapping behavior. It does not conflict with ActionView::Base.field_error_proc so non-bootstrap forms function normally.
This gem seems like a good home for a bootstrap form builder so I thought I would share what I have if you wish to use it as a starting point. It obviously is very basic and needs refinement but it gets the job done.
The text was updated successfully, but these errors were encountered: