Is it possible to use the bootstrap radio buttons i.e:
<div class="btn-group" data-toggle="buttons-radio">
<button type="button" class="btn btn-primary">someValue</button>
with a form_for in rails? There is a radio_button method:
<%= radio_button("object", "method", "someValue") %>
, but I wasn't able to style it. I didn't know if there is someway to merge the two to give the radio button the bootstrap appearance of the first snippet. Thanks, Sam
you can use like this,
<div class="btn-group" data-toggle="buttons-radio">
<%= f.radio_button :brand, "ABC", :id=>"first", :style=>"display:none;" %>
<label for="first" class="btn btn-primary">First</label>
<%= f.radio_button :brand, "PQR", :id=>"second", :style=>"display:none;" %>
<label for="second" class="btn btn-primary">Second</label>
<%= f.radio_button :brand, "MNO", :id=>"third", :style=>"display:none;" %>
<label for="third" class="btn btn-primary">Third</label>
</div>
here you need to give id to radiobutton and can assign the label to it by using for attribute in label tag. So that it can indicate corresponding radio button.
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