I'm currently using the bootstrap_form 2.4.0
gem to make forms for my rails application. I'm at a point where i'm trying to create an annotation feature, where a person can go into the 'edit' page for an entry and decide which fields are valid or invalid by ticking or un-ticking a check-box next to that field.
So basically i need to create check-boxes in my 'edit' form that consist of only a glyph icon or an image.
I tried using the solution given by RemusGLS in this post: Is it posible to make an input checkbox a Bootstrap glyphicon? , which i modified to look how i want it to here
The problem is, this solution works for the basic form creation which is simply done by using the <input type="checkbox">
tag . and if i just use this method, it causes problems with the 'edit' page (as the check-boxes reset, which negates the whole point of the annotation ).
after inspecting the checkbox element that bootstrap form generate with the line
<%= f.check_box :blabla , label: "" %>
it seems that it generates this code
<label for="entry_blabla">
<input name="entry[blabla]" type="hidden" value = "0" >
<input type="checkbox" value="1" checked="checked" name="entry[blabla]" id="entry_blabla" >
</label>`
that automatically changes based on the value of field (blabla
in this case), i tried to use an if statement to simulate this code but i still cant integrate it with the solution to the icon checkboxes.
To sum it up in one sentence, I simply need the icon check-boxes solution (given here) to work with the Bootstrap form format (this one: <%= f.check_box :blabla , label: "" %>
).
Thank You.