Skip to content Skip to sidebar Skip to footer

Rails Field_with_errors And Bootstrap Form-horizontal

In my custom.css.scss file, I have: .field_with_errors { @extend .control-group; @extend .error; } The problem is that for Bootstrap horizontal forms, the fields will not rema

Solution 1:

I fixed it with the following css:

.form-horizontal.field_with_errors
{
  margin: 0;
}

.form-horizontal.field_with_errors:before, .form-horizontal.field_with_errors::after 
{
  display: block;
  clear: none;
}

Solution 2:

You have some extraneous .control-group divs in there. Simply adding the error class to the enclosing control-group div should give you the desired result:

<div class="control-group error">
  <labelclass="control-label"for="bookmark_url">Url</label><divclass="controls"><inputid="bookmark_url"name="bookmark[url]"size="30"type="text"value=""></div></div>

Post a Comment for "Rails Field_with_errors And Bootstrap Form-horizontal"