Opened 9 years ago

Closed 9 years ago

#11361 closed (invalid)

Using javascript in Django

Reported by: WilsonOfCanada Owned by: nobody
Component: Forms Version: master
Severity: Keywords: Javascript, HTML
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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 or Django does not support javascript at all.



{% extends "Basic.html" %}

{% block body %}

<form action="/Results/" method ="post">

<div id="formSite">
	<div id="navBar">


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

			<input type="submit" value="Select"><br/>




{% endblock %}

(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'C:\\ ... \\media\\'}),

(The images and css files work)

Change History (1)

comment:1 Changed 9 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top