Giter Site home page Giter Site logo

Comments (17)

yury avatar yury commented on June 12, 2024

I need a little bit help on your side.

  1. Are you using simple_form?
  2. Can you show view part for date/time?

from anjlab-widgets.

yury avatar yury commented on June 12, 2024

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

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

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 [email protected] 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.

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

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} %>

from anjlab-widgets.

yury avatar yury commented on June 12, 2024

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'} %>

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

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"

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

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.

from anjlab-widgets.

yury avatar yury commented on June 12, 2024

that with as: :string?

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

Yep, as this:

<%= f.input :date, as: :string, label: 'Event Start Date:', input_html: {data: {widget: 'datepicker'}, type: 'date'} %>

from anjlab-widgets.

yury avatar yury commented on June 12, 2024

Do you lang attribute in your html tag?

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

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?

from anjlab-widgets.

yury avatar yury commented on June 12, 2024

Yep, in html document it should be like

<html lang='en'>….

Trying to reproduce…. without luck...

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

Don't know if they will help any, but it's a quick screencast of the problem.

http://cl.ly/213y0S3N2Z1Y

On Aug 5, 2013, at 1:28 PM, Yury Korolev [email protected] wrote:

Yep, in html document it should be like

….

Trying to reproduce…. without luck...


Reply to this email directly or view it on GitHub.

from anjlab-widgets.

yury avatar yury commented on June 12, 2024

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'} %>

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

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 ;)

from anjlab-widgets.

yury avatar yury commented on June 12, 2024

Wait a moment….

Are you still using anjlab-widgets pickers and they work or you switched to bootstrap-rails-timepicker?

Sorry my bad english :(

from anjlab-widgets.

DevanB avatar DevanB commented on June 12, 2024

Your English is just fine :)

I am still using anjlab-widgets. The bootstrap-rails-timepicker would not work, so I switched to anjlabs :)

from anjlab-widgets.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.