This code:
<%= f.input :exploratory, as: :radio_buttons,
collection: [['Exploratory', true], ['Preparatory', false]],
label: false %>
Produces this result:
Which is almost exactly what I want - the only problem is the "Exploratory" label above the radio buttons.
Is there a way to have simple_form omit the label for the radio button set and just display the individual button labels? Or if that is not possible, is there a way that I can set the label to a different value.
I'm using Simple Form 4.1.0 with Rails 5.2.3 and Bootstrap 4.3.1.
This is an issue with the simple_form_bootstrap
wrappers, for collection inputs you have to specify legend_tag: false
instead of label: false
.
Try adding label: false
<%= f.input :exploratory, as: :radio_buttons,
collection: [['Exploratory', true], ['Preparatory', false]],
label: false %>
This should generate the HTML without label
Tested
Also, you can change the label by adding label: 'Changed label'
<%= f.input :exploratory, as: :radio_buttons,
collection: [['Exploratory', true], ['Preparatory', false]],
label: 'Changed Label' %>
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