Using Simple_form 2.0.2
The simple form code using HAML:
= f.input :remember_me, as: :boolean, inline_label: 'Remember me'
But it renders this:
<div class="control-group boolean optional">
<label class="boolean optional control-label" for="admin_remember_me">Remember me</label>
<div class="controls">
<input name="admin[remember_me]" type="hidden" value="0" />
<label class="checkbox"><input class="boolean optional" id="admin_remember_me" name="admin[remember_me]" type="checkbox" value="1" />Remember me</label>
</div>
</div>
How do I remove that first label that's rendered, so that I only have the inline label?
You can use:
= f.input :remember_me, as: :boolean, inline_label: 'Remember me', label: false
Found a solution after much Google fu.
Use input_field
instead of input
which won't automatically generate a label.
= f.input_field :remember_me, as: :boolean, inline_label: 'Remember me'
For whom it doesn't work
= f.input_field ...
Use this way
= f.check_box ...
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