0

在我的应用程序中,我希望实现 AM 和 PM 功能。用户不应该自己输入。我有一个文本框,用户应该只输入数字我还想添加时间选择器。

  %li
    %label{:for => "start_time"}Start_time<em>*</em>
    = f.text_field :start_time, :required => "required", :autofocus => true


  %li
    %label{:for => "end_time"}End_time<em>*</em>
    = f.text_field :end_time, :required => "required", :autofocus => true
4

1 回答 1

0

实际上,您可以使用time_select方法并执行以下操作:

time_select("event", "start_time", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})

time_select("event", "end_time", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})

希望能帮助到你!

于 2012-05-02T10:23:40.147 回答