-
Notifications
You must be signed in to change notification settings - Fork 154
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
Undefined is not a function error #44
Comments
Do you already have loaded jquery library in your page? |
Yes, I have loaded jquery in my head before including {{form.media}} |
Have you checked the generated html output?
|
I'm having the same problem... It looks like adding the app to the installed apps doesn't add the javascript files... form.media doesn't either. Or there is a problem with having head in base.html and extending base.html. |
Maybe I'm wrong, but simply check the real datepicker id. |
I figured out the issue. If you change the name of the form you send to the template genorator, say my_form instead of form, you have to use {{my_form.media}}. If you have more then one form with a datepicker it is safe to call {{my_form.media}}{{my_other_form.media}}; resources will not be included twice. OP must be passing the form under a different name, e.g. service_form, in the return render, which means he's not loading the resources and the datetimepicker function call can't be found thus generating the error he is getting. |
Developers you should make a note about this in the readme. |
Perhaps write in an example view where you retrieve and pass the form to the return render and highlight that the name of your form in the view must be the name you use in the {{form.media}} tag. |
Wait... Maybe I'm wrong about the problem. Either way that was my issues. |
this is my forms.py
this is my template;
I have included the {{form.media}} tag in my head but I'm getting undefined is not a function error in my console and the datepicker is not opening.
The text was updated successfully, but these errors were encountered: