Comfy Mexican Sofa comfy_form_for remove form labels

192 Views Asked by At

Does anyone know how to remove form labels? I have tried:

<%= comfy_form_for @comment, :as => :comment, options: {label: false}, :url => comfy_blog_comments_path(@cms_site.path, @blog.path, @post.slug) do |form| %>

also

<%= comfy_form_for @comment, :as => :comment, default: {label: false}, :url => comfy_blog_comments_path(@cms_site.path, @blog.path, @post.slug) do |form| %>

and also

<%= form.text_field :email, label: false, :class => 'form-control' %>

all to no avail...

2

There are 2 best solutions below

0
Grocery On BEST ANSWER

ComfortableMexicanSofa is using https://github.com/bootstrap-ruby/rails-bootstrap-forms

So I think you need to do this:

<%= f.text_area :email, hide_label: true %>

0
Jax On

Also for those wanting to completely remove the labels from the DOM, here is how to achieve it, according to rails-bootstrap-forms docs you should do the following:

HTML:

 <%= form.text_area :content, :class => 'form-control', :rows => 5, placeholder: "Your comment", label_class: "removed-label" %>

CSS:

.removed-label {
  display: none;
}

Hope it helps someone down the line.