0

I've got a form for selecting TIME. I'm using Simple Form and Jquery Timepicker. How do I remove the minute field of the form. So I have two fields for the :mondayopen parameter showing up. One is the hour and the other is the minute. How can I remove the minute.

Here's how it currently looks: enter image description here

My Form

<%= simple_form_for [current_user, @store], :html => {:multipart => true, :class => 'form-horizontal'} do |f| %>
    </br>
    <%= f.input :mondayopen, :label => 'Monday Open Time', :input_html => { :class => 'mondayo' } %>        
    <%= f.button :submit, class: 'btn btn-primary', style: 'margin-left: 40px;'  %><%= link_to 'Your Store', user_store_path(current_user, @store), :class => 'btn btn-inverse edit_store_button_path' %>
<% end %>

<script>
    $('.mondayo').timepicker({ 'step': 15 });
    $('.mondayc').timepicker({ 'step': 15 });
</script>
4

1 回答 1

1

If you have mondayopen field as time type field SimpleForm creates time_select for you but you don't need it as you are using jquery timepicker plugin. So you can just redefine it like this:

<%= f.input :mondayopen, :as => :string, :label => 'Monday Open Time', :input_html => { :class => 'mondayo' } %>        
于 2012-12-26T05:38:41.700 回答