Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot call method 'getHours' of undefined #1

Closed
j-5-s opened this issue Sep 10, 2011 · 5 comments
Closed

Uncaught TypeError: Cannot call method 'getHours' of undefined #1

j-5-s opened this issue Sep 10, 2011 · 5 comments

Comments

@j-5-s
Copy link

j-5-s commented Sep 10, 2011

Hello,

First off, thank you for creating backbone-forms. I've forked it and have run into a problem with DateTime. Not sure if I'm just not getting it or its a bug. The exact error i'm getting is with DateTime in the schema.

"Uncaught TypeError: Cannot call method 'getHours' of undefined"

You can clone my fork here to reproduce. https://github.com/jamescharlesworth/backbone-forms. Just load the index.html page and you should see the error.

Thank you,

James

@j-5-s
Copy link
Author

j-5-s commented Sep 10, 2011

So this happens if you dont set an attribute with a value prior to setting the form. I added a default value if empty for date, but the datepicker still does not seem to render.

https://github.com/jamescharlesworth/backbone-forms/commit/9992e750c446585a1d2f15f32fee4f37e6a68dcb#src/jquery-ui-editors.js

@powmedia
Copy link
Owner

Thanks James, will look into this

@j-5-s
Copy link
Author

j-5-s commented Sep 10, 2011

No problem. Looks like the datepicker has some issues when being rendered with dom elements. Appending the html of the widget to exports.Date seemed to do the trick.

https://github.com/jamescharlesworth/backbone-forms/commit/ad74e7d7217283ac3949130de87c841014d499f1

Let me know if you think there is a better way to accomplish this. Thanks!
James

@powmedia
Copy link
Owner

I've pushed an update that includes setting the default Date, as well as a UI test for dates and datepickers - see if the date editors work for you now. If you open test/index.html and go to the bottom of the page you should see the Date, DatePicker and List editors on the page.

@j-5-s
Copy link
Author

j-5-s commented Sep 13, 2011

Thanks. The date issue seems to be fixed, but the calendar still does not load for me when called after the dom has already loaded. Most likely a mistake on my implementation, but will let you know it it turns out to be your code.

@j-5-s j-5-s closed this as completed Sep 13, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants