Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added :wrapper_html example to the README.

  • Loading branch information...
commit 8ee50d81e35826f856bb60b9255a0d640cec863d 1 parent d1f34e0
@olivierlacan olivierlacan authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 README.md
View
11 README.md
@@ -97,6 +97,17 @@ It is also possible to pass any html attribute straight to the input, by using t
<% end %>
```
+Since simple_form generates a wrapper div around your label and input by default, you can pass any html attribute to that wrapper as well using the :wrapper_html option, like so:
+
+```erb
+ <%= simple_form_for @user do |f| %>
+ <%= f.input :username, :wrapper_html => { :class => 'username' } %>
+ <%= f.input :password, :wrapper_html => { :id => 'password' } %>
+ <%= f.input :remember_me, :wrapper_html => { :class => 'options' } %>
+ <%= f.button :submit %>
+ <% end %>
+```
+
By default all inputs are required, which means an * is prepended to the label, but you can disable it in any input you want:
```erb
Please sign in to comment.
Something went wrong with that request. Please try again.