Closed DevanB closed 11 years ago
I need a little bit help on your side.
date/time elements generates on(2i), on(1i) and so on by default. You should pass rails: false in input_html options to disable that
Sure!
I'm using simple_form and setup the initializer like so: Anjlab::Widgets.simple_form
here are my two fields. The fields in the db are a :string (varchar) not a :datetime.
<%= f.input :time, as: :anjlab_time, label: 'Event Start Time:' %>
<%= f.input :date, as: anjlab_date, label: 'Event Start Date:' %>
On Aug 5, 2013, at 11:03 AM, Yury Korolev notifications@github.com wrote:
I need a little bit help on your side.
Are you using simple_form? Can you show view part for date/time? — Reply to this email directly or view it on GitHub.
If I understand it correctly the fields should be as such:
<%= f.input :time, as: :anjlab_time, label: 'Event Start Time:', :input_html => {rails: false} %>
<%= f.input :date, as: :anjlab_date, label: 'Event Start Date:', :input_html => {rails: false} %>
I was wrong…
For you, it is better to use plain strings
<%= f.input :time, as: :string, label: 'Event Start Time:', input_html: {data: {widget: 'timepicker'}, type: 'time'} %>
<%= f.input :date, as: :string, label: 'Event Start Date:', input_html: {data: {widget: 'datepicker'}, type: 'date'} %>
I can see it is putting rails: false in, but I still get the error.
input class="anjlab_time optional" data-rails="true" data-widget="timepicker" id="event_time" name="event[time]" rails="false" size="30" type="text" value="" data-validate="true"
Well that is working for the time selection, but not the date. When using the date selection I can see the MM/DD/YYYY placeholder, but when I select a date from the drop down calendar, it doesn't actually update the placeholder with the new input.
that with as: :string
?
Yep, as this:
<%= f.input :date, as: :string, label: 'Event Start Date:', input_html: {data: {widget: 'datepicker'}, type: 'date'} %>
Do you lang attribute in your html tag?
I'm not quite sure what you mean. I'm new to Rails, just building something to teach myself.
I'm assuming you mean does my tag look like this at the top of application.html.erb:
html lang="en"
Is that right?
Yep, in html document it should be like
<html lang='en'>….
Trying to reproduce…. without luck...
Don't know if they will help any, but it's a quick screencast of the problem.
On Aug 5, 2013, at 1:28 PM, Yury Korolev notifications@github.com wrote:
Yep, in html document it should be like
…. Trying to reproduce…. without luck... — Reply to this email directly or view it on GitHub.
Yep, video does help a lot.
for now please use type text for your date/time inputs
<%= f.input :date, as: :string, label: 'Event Start Date:', input_html: {data: {widget: 'datepicker'}, type: 'text'} %>
Thanks for the help! I haven't been able to get a time picker or date picker working (and I tried the bootstrap-rails-timepicker/datepicker gem) for over a month now!
I'm not quite sure what is happening in the data-widget stuff, but thanks! Hopefully I helped you some also with the gem ;)
Wait a moment….
Are you still using anjlab-widgets pickers and they work or you switched to bootstrap-rails-timepicker?
Sorry my bad english :(
Your English is just fine :)
I am still using anjlab-widgets. The bootstrap-rails-timepicker would not work, so I switched to anjlabs :)
I get that dreaded Multiparameter error when I try to edit a record that has been created with the timepicker and datepicker. Any idea how to avoid this? I'm writing the time and date to the database as a string not datetime format, if that helps.
ActiveRecord::MultiparameterAssignmentErrors in EventsStepsController#create 1 error(s) on assignment of multiparameter attributes