:combined => true doesn't seem to work
yubrew opened this issue · comments
I'm using simple_form gem with combined_time_select.
<%= simple_form_for @event, :id => 'access_form' do |f| %>
<%= f.input :start_date, :as => :date, :label => "Start Date" %>
<%= f.input :start_date, :combined => true, :as => :time, :minute_step => 30, :label => "Start Time" %>
<% end %>
I get the following html
<div class="input time optional"><label class="time optional control-label" for="event_start_date_4i">Start Time</label><input id="event_start_date_1i" name="event[start_date(1i)]" type="hidden" value="2012" />
<input id="event_start_date_2i" name="event[start_date(2i)]" type="hidden" value="12" />
<input id="event_start_date_3i" name="event[start_date(3i)]" type="hidden" value="18" />
<select class="time optional" id="event_start_date_4i" name="event[start_date(4i)]">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option selected="selected" value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
</select>
: <select class="time optional" id="event_start_date_5i" name="event[start_date(5i)]">
<option value="00">00</option>
<option value="30">30</option>
</select>
</div>
It seems like the :combined
option is not working.
I'm not too familiar with the internals of either simple_form or formtastic. What combined_time_select
does is override the time_select method to provide you the combined time fields.
The simplest solution would be to not use simple_form for this one field and label. You can continue to use simple_form for the rest of your attributes, but you can just write it by hand like the readme example as a quick solution.
I can look into what it would take to integrate sometime, but it will take some digging I think.
i realize this issue is 2 years old, but i'm running into the same problem with formtastic and can't find a solution anywhere so i was wondering if there's an update i'm not seeing anywhere.
thanks
For future reference, notes on how to do this in #8.