0

I would like the date picker update the "date" part of the datetime and time_select update the "time" part of a date time What I tried:

<%= f.text_field :Start_Time , :class => 'datepicker' %> <P>
<%= f.time_select :Start_Time, :class => 'time_select' ,:ignore_date => true %>

but it does not work

1 error(s) on assignment of multiparameter attributes

{"utf8"=>"✓",
 "authenticity_token"=>"5gQBBtVp8F1363IWsxzl9sF9QC9oAjP37r1e9pyS1NQ=",
 "booking"=>{"Create_Date"=>"",
 "Start_Time"=>"2013/03/06",
 "Start_Time(4i)"=>"18",
 "Start_Time(5i)"=>"06",
 .....

The datepicker could update a date field but cannot update the date part of datetime field Could anyone tell me what is missing there?

1 Answer 1

1

I don't think you can do that. You have to submit them as separate attributes and then write a method to join them in the model.

Alternatively, if you're using the jquery-ui datepicker, you can just add the time addon and create a new css class 'datetime_picker' + js initializer. That way, you can do:

f.text_field :Start_Time , :class => 'datetime_picker'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.