ruby on rails - Limit minutes list on datetime_select -
i using rails on web application. know if possible tell datetime_select
have 2 options in minutes drop downwards list? options 00 , 30.
i have below code:
<p><label for="command_date_to_execute">date run</label><br/> <%= datetime_select 'command', 'date_to_run', :discard_minute => true %>: <%= select 'command', 'date_to_run', ['00', '30'] %> </p>
the browser source produces:
<select id="command_date_to_run" name="command[date_to_run]"> <option value="00">00</option> <option value="30">30</option> </select>
but need below (with 5i in generated html):
<select id="command_date_to_execute_5i" name="command[date_to_execute(5i)]"> <option value="00">00</option> <option value="30">30</option> </select>
please help
if want values 00 , 30 displayed minutes, can below:
= f.datetime_select(:leave_end, :start_year => 2011, :ampm => true, :default => 0.days.from_now.in_time_zone(@timezone), :discard_minute => true) %span : = f.select('req_sess_start(5i)', ['00', '30'])
this might exceptions on page validation due (possibly) unknown variable req_sess_start(5i). work if validation met.
the below work improve though not throw exception.
= f.datetime_select(:req_sess_start, :start_year => 2011, :ampm => true, :default => 0.days.from_now.in_time_zone(@timezone), :minute_step => 30)
ruby-on-rails ruby
No comments:
Post a Comment