Opened 15 years ago
Closed 15 years ago
#11361 closed (invalid)
Using javascript in Django
Reported by: | WilsonOfCanada | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | Javascript, HTML | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello ppl,
I am trying to use javascript in the html for an "onChange" event; however, anything enclosed between the script tags are excluded. Now I am wondering if I am missing something or the path in url.py or Django does not support javascript at all.
Thanks
html
{% extends "Basic.html" %} {% block body %} <form action="/Results/" method ="post"> <div id="formSite"> <div id="navBar"> </div> <div id="mainCol"> <script language="JavaScript" type="text/javascript" src="/site_media/js/foo.js"> <label for="selectCountry">Select Country: </label> <select name="selectCountry" id="selectCountry" onChange="changeProvince()"> <option value="Canada" selected="selected">Canada</option> <option value="US">United States</option> <option value="France">France</option> </select> <input type="submit" value="Select"><br/> </script> </div> </div> </form> {% endblock %}
urls.py
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'C:\\ ... \\media\\'}),
(The images and css files work)
Note:
See TracTickets
for help on using tickets.
Django is a server-side HTTP web application framework. It has nothing to do with Javascript on the client side. Django just serves the pages it is told to serve. If those pages contain Javascript, it is up to the client to interpret that code.
Furthermore, the Django ticket system is not for answering "how to" questions - it is for tracking bugs. If you have a question of usage, please ask on Django-users - although, in this case, it may be appropriate to find a forum with a Javascript focus.