ruby on rails - Buttons (toggle buttons?) instead of radio buttons in an ActiveRecord form using bootstrap? -


i want have selector "priority" on form looks this: toggle buttons

but can't figure out how link activerecord. straight-html "toggle buttons":

<div class="btn-group">    <a class="btn" href="#"><i class="icon-arrow-down"></i> &nbsp; low</a>    <a class="btn btn-warning active" href="#"><!-- class="icon-white icon-adjust"></i--> medium</a>    <a class="btn" href="#"><i class="icon-arrow-up"></i> &nbsp; high</a> </div> 

and i've got working radio buttons, thinking maybe can style them regular inline buttons. not sure if can specify class each button without jquery:

<%= f.collection_radio_buttons :priority, [["c - low", 'low'],                                            ["b - medium", 'medium'],                                            ["a - high", 'high']], :first, :last %> 

any ideas on how make buttons active 1 pressed in?

ended using hidden input field binded directly priority column in database:

<%= f.input :priority, as: :hidden %> 

then using jquery make buttons clickable (and change value in hidden field).


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -