I'm trying to stop simple_form
from adding error labels entirely.
tried the followign CSS:
label.error { display:none; }
but simple_form
's JavaScript is setting the following rule when it's generated:
display: block;
Am I missing a config that lets me turn off generation entirely?
This stops them from appearing, which works for now:
label.error {
display: none !important;
visibility:hidden;
}
Give this a try:
<%= f.input :password, error: false %>
Source @ lib/simple_form/components/errors.rb
If you want to disable for ALL fields, I believe you'd have to put this on all fields.
You can also disable labels, hints or error or configure the html of any of them:
<%= simple_form_for @user do |f| %>
<%= f.input :username, :label_html => { :class => 'my_class' } %>
<%= f.input :password, :hint => false, :error_html => { :id => "password_error"} %>
<%= f.input :password_confirmation, :label => false %>
<%= f.button :submit %>
<% end %>
For further reference check the link below:
https://github.com/plataformatec/simple_form
If you want to disable error messages on inputs site-wide, you can set this easily in the initialiser config/initializers/simple_form.rb
:
SimpleForm.setup do |config|
config.wrappers :default, class: :input,
# Comment this line!
#b.use :error, wrap_with: { tag: :span, class: :error }
end
end
You will no longer see the validation messages beside every input.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With