Fernando Shayani
unread,Apr 13, 2012, 9:00:01 AM4/13/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to SimpleForm
Hi all. I posted this question in the GitHut site but I'll also post
here. Any help will be useful :)
I'm having some trouble to create a group of checkboxes with
simple_form and bootstrap.
I have 3 fields in the database that are booleans: option1, option2
and option3. I need to create a checkbox group inline like this:
SELECT YOUR OPTIONS: [ ] Option 1 [ ] Option 2 [ ] Option 3
Rails is expecting to send the fields as independent fields, like
"tablename[option1]" , "tablename[option2]" and "tablename[option3]".
If I use the
f.input :option, :collection => [[true, '1'] ,[true, '2'],[true,
'3']], :as => :check_boxes
, the html markup will be messed up.
I'm looking for a way so the markup will something like:
<input name="tablename[option1]" type="hidden" value="0">
<input name="tablename[option2]" type="hidden" value="0">
<input name="tablename[option3]" type="hidden" value="0">
If I just use the
f.input :option1
f.input :option2
f.input :option3
the checkboxes will be vertical and will not be "grouped".
Any ideas?