Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:11:32+00:00 2026-06-03T23:11:32+00:00

I have a bunch of partials that I want to render horizontally, using form-inline

  • 0

I have a bunch of partials that I want to render horizontally, using form-inline (twitter bootstrap). If specified individually they work fine, but when specified using :defaults, the class doesn’t appear.

%ul.nav.nav-tabs#tab
  %li= link_to "General", "#client_tab1", 'data-toggle'=>"tab"
  %li= link_to "Applications", "#client_tab2", 'data-toggle'=>"tab"
= simple_form_for @client, defaults:{input_html:{class:'form-inline'}}, :html=>{:class=>"client tab-content"} do |f|
  #client_tab1.tab-pane.fade.in.active
    = render :partial => "client", :locals => {:f => f}
  #client_tab2.tab-pane.fade.in
    = render :partial => "applications/applications", :locals => {:f => f}
  .actions
    = f.button :submit, class:"btn-primary", value: "Save"

and the partial looks something like:

.status
  .span3
    = f.label :status
    = f.collection_select :status_id, selection_list(Status), :last, :first
    %br
    = f.input :open_date, :as => :jdate
    %br
    = f.label :assigned_to
    = f.collection_select :assigned_to_id, selection_list(User), :last, :first
    %br
    .form-inline
      = f.label :assistant
      = f.collection_select :assistant_id, selection_list(User), :last, :first
    %br

In the above, with explicit .form-inline, all works as expected. But according to the sample code below from https://github.com/plataformatec/simple_form, classes defined in :defaults should be applied to all methods. In fact, they aren’t.

<%= simple_form_for @user, :defaults => { :input_html => { :class => 'default_class' } } do |f| %>
  <%= f.input :username, :input_html => { :class => 'special' } %>
  <%= f.input :password, :input_html => { :maxlength => 20 } %>
  <%= f.input :remember_me, :input_html => { :value => '1' } %>
  <%= f.button :submit %>
<% end %>

Can anyone explain why this might be or what I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:11:34+00:00Added an answer on June 3, 2026 at 11:11 pm

    Several things:

    1. From reading the twitter bootstrap documentation, it looks like the form-inline class works when applied to the parent element to the input field, such as a form element or, in your example, a div.

    You can see that here (taken from the stylesheet):

    .form-search input,
    .form-inline input,
    .form-horizontal input,
    .form-search textarea,
    .form-inline textarea,
    .form-horizontal textarea,
    .form-search select,
    .form-inline select,
    .form-horizontal select,
    .form-search .help-inline,
    .form-inline .help-inline,
    .form-horizontal .help-inline,
    .form-search .uneditable-input,
    .form-inline .uneditable-input,
    .form-horizontal .uneditable-input,
    .form-search .input-prepend,
    .form-inline .input-prepend,
    .form-horizontal .input-prepend,
    .form-search .input-append,
    .form-inline .input-append,
    .form-horizontal .input-append {
      display: inline-block;
      *display: inline;
      margin-bottom: 0;
      *zoom: 1;
    }
    
    1. I read the simple_form documentation to mean that the defaults will only be applied to f.input methods. I think this means that this means what’s provided to input_html will be applied to all the elements generated by f.input, including the label and the input field itself. However, it doesn’t look like f.input generates any parent element to the input field, like a div.

    So, since twitter bootstrap only applies the style when there’s a parent element, like a div, whose class is form-inline, it won’t matter if form-inline is applied to the input field.

    It doesn’t seem like it adds too much to just keep .form-inline in the partial, why not just keep it there?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of Posts. I want that for the index action, the
I have a bunch of html files that come with my app and are
I have a bunch of code in a routine that looks a bit like
I have a bunch of strings that are dependent on static dictionaries and each
I have a bunch of buttons that have a tapGestureRecognizer linked to them, and
I'm working with ASP.NET MVC 2. I have a bunch of partial views that
I have a complex form for a model Schedule that belongs to a parent
I've got a bunch of strongly typed DataSet that each have two tables. One
I have a bunch of models that contain audit info (CreatedBy, CreateDate, UpdatedBy, UpdateDate).
I have a bunch of windows forms. Each form has Back and Next buttons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.