Reputation: 33755
Per the docs I have tried many variations, but none seem to work.
What I would like to happen is this:
<form accept-charset="UTF-8" action="/listings" class="simple_form new_listing form-horizontal" id="new_listing" method="post" novalidate="novalidate">
But when I tried this:
<%= simple_form_for @listing, :defaults => { :class => 'form-horizontal' } do |f| %>
This is generated:
<form accept-charset="UTF-8" action="/listings" class="simple_form new_listing" id="new_listing" method="post" novalidate="novalidate">
Notice no form-horizontal
in the class attribute.
When I try:
<%= simple_form_for @listing, :defaults => { :wrapper_html => { :class => 'form-horizontal' } } do |f| %>
This is the output generated:
<form accept-charset="UTF-8" action="/listings" class="simple_form new_listing" id="new_listing" method="post" novalidate="novalidate">
It also applies that class to all the elements within the form, e.g.:
<div class="control-group select optional form-horizontal">
Which is not the outcome I want.
I also tried this:
<%= simple_form_for @listing, :defaults => { :input_html => { :class => 'form-horizontal' } } do |f| %>
This is the form
output it produced:
<form accept-charset="UTF-8" action="/listings" class="simple_form new_listing" id="new_listing" method="post" novalidate="novalidate">
Which looks just like some of the other outputs, but the difference is that it applied that class to all input
elements within the form, like this:
<input class="numeric float optional form-horizontal">
So....I have tried everything I can think of, and everything seen in the docs (I think).
What have I missed?
Thanks.
Edit 1:
I also tried the obvious, 'normal' version:
<%= simple_form_for @listing, :class => 'form-horizontal' do |f| %>
That generates this:
<form accept-charset="UTF-8" action="/listings" class="simple_form new_listing" id="new_listing" method="post" novalidate="novalidate">
Upvotes: 0
Views: 116
Reputation: 29291
<%= simple_form_for @listing, :html => { :class => 'form-horizontal' } do |f| %>
That doesn't work?
Upvotes: 1