0

I'm using the code:

<fieldset>
    <div class="row">
        <div class="col-sm-5">
            Price (in $): <%= f.input :price, label: false %>
        </div>  
        <div class="col-sm-5"> 
           <%= f.association :school, :collection => School.all.order(:name), as: :select %>
        </div>
        <div class="col-sm-2">
            <%= f.label :_destroy, "Remove" %>
            <%= f.check_box :_destroy %>
        </div>
   </div>
   <div class="row">
        <div class="col-sm-6">
            <%= f.input :begin, :include_blank => true %>
        </div>
        <div class="col-sm-6">
            <%= f.input :enddate, :include_blank => true %>
        </div>
    </div>
</fieldset>

And ending up with this result:

https://i.stack.imgur.com/KISbQ.png

Is there any way I could make it so the 'begin' and 'enddate' forms don't take up 3 lines? I want to put 'begin' spanning only 1 line, and 'enddate' spanning the line below it. Any clue on how to do this?

(I'm one of two people working on this site and am unsure if 'begin' and 'enddate' forms are defined somewhere else)

engineersmnky
  • 25,495
  • 2
  • 36
  • 52
Ethanph89
  • 187
  • 1
  • 1
  • 8
  • By default `rails` will use `date_select` for a date object. `date_select` provides 3 drop downs year, month and day. To solve this I usually create a custom input and use a jQuery date_picker and minimal js to handle generating a single box. This [SO Post](http://stackoverflow.com/questions/3329381/how-do-i-connect-jquery-datepicker-to-my-ruby-on-rails-form) offers some useful resources to achieve just that – engineersmnky Jan 16 '17 at 21:37
  • Do you use some form-helper (other than the default rails one)? Like Formtastic? What does the object/model look like you're using the inputs on? EG, does the `@object.begin`-field represent a date in the DB? Maybe you can provide the full code where you initiate the form (and thus the local `f`). – Philipp Meissner Jan 17 '17 at 14:32

1 Answers1

0

Have you tried using f.datetime_local_field instead of f.input? I have never had that issue before when creating a datetime input field.

LBarry
  • 115
  • 9