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 7555237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:33:16+00:00 2026-05-30T11:33:16+00:00

This may be a beginners question but not having much luck getting this going.

  • 0

This may be a beginners question but not having much luck getting this going. The background:

  1. Rails 3.0.x version
  2. Bootstrap 2.0 – using as pre-compiled simply placed into public/stylesheets.
    Att
  3. Attempting to do a form with horizontal layout, i.e. label next to the input field on the same line.

The issue is that I can’t get the form to work, but can get the default Bootstrap sample code, in the same form to layout correctly. The Rails form looks like:

<div class="row-fluid">
  <div class="span4 well">
    <%= form_for @member, :html => {:class => "form-horizontal"} do |m| %>
        <fieldset>

          <%= m.label :title  %>
          <%= m.text_field :title %>   

          <%= m.label :first_name %>
          <%= m.text_field :first_name %>
    <% end %>
   </div>
</div>

Notice that the form_for method has the class of form-horizontal as described by in Bootsrap form CSS

When displayed the label, for example title, is on one line left adjusted and then on the next line is the input field, also left adjusted.

Now if I include some of the sample Bootstrap code for forms such as:

<div>
  <form class="form-horizontal">
    <fieldset>
      <legend>Legend text</legend>
      <div class="control-group">
        <label class="control-label" for="input01">Text input</label>

        <div class="controls">
          <input type="text" class="input-xlarge" id="input01">

          <p class="help-block">Supporting help text</p>
        </div>
      </div>
    </fieldset>
  </form>
</div>

Then I get the expected outcome — label and input field on the same line in horizontal layout.

I’ve tried adding the style “control-label” onto the m.label and m.text_field components but no joy in getting the layout as horizontal.

Thus, not sure what the issue is, since the working part validates that I can get Bootstrap to work, although with my Rails Form it’s not honouring the form-horizontal.

  • 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-05-30T11:33:18+00:00Added an answer on May 30, 2026 at 11:33 am

    If you want to do the form vanilla (as in, without simpleform-bootstrap or other gems), you need to shape the form HTML accordingly:

    <div class="row-fluid">
      <div class="span4 well">
        <%= form_for @member, :html => {:class => "form-horizontal"} do |m| %>
            <fieldset>
              <legend>Member Form</legend>
              <div class="control-group">
                <%= m.label :title, :class => "control-label" %>
                <div class="controls">
                  <%= m.text_field :title, :class => "input-xlarge" %>
                </div>
              </div>
    
              <div class="form-actions">
                <%= m.submit :class => "btn btn-primary" %>
              </div>
            </fieldset>
        <% end %>
      </div>
    </div>
    

    As Arun Kumar Arjunan says, the form builder is not generating the html needed for the bootstrap framework.

    Definitely check out the HTML needed in the bootstrap example pages, and/or by inspecting the DOM (i found that it’s not really well documented). All in all, you can do it manually, like above, by creating your own form builder, or by using various gems.

    Also as a sidenote, make sure to check out how to customize the errors css, because by default, when a validation error occurs, the field is wrapped by a <div class ="field_with_errors"> breaking the css selectors used by bootstrap.

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

Sidebar

Related Questions

This may sound like a stupid question but I'm a beginner not just to
This may be a beginner xml question, but how can I generate an xml
This may seem like a daft question, but i was wondering about how to
This question may sound like for beginners, however when I found that out I
I know that my this question may sound pathetic to you but as a
This question may be simple for experts but for a beginner like me it
I know this may be a low quality question but please dont -rep me
This may be an easy question but I am a beginner with the linker
I posted this question here before but there were no responses. I may have
I am relatively new to jQuery so this may be a beginners mistake, but

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.