Django templates onchange data
In the following code, i have a drop down box and a multi select box.
My question is that using javascript and django .how will i changes the designation with changes in names from drop down box.
<tr><td>
name:</td><td><select id="name" name="name">{% for name in names %}
<option value="{{name.id}}" {% for selected_id in names %}{% ifequal name.id selected_id %} {{ selected }} {% endifequal %} {% endfor %}>{{name.name}}</option>{% endfor %}
</select>
</td></tr>
{% for desg in designation %}
<tr><td><p>Topics:</td><td> <select id="desg" name="desg" multiple="multiple">
<option value="{{desg.id}}" >{{desg.desg}}</option>
</select></p></td></tr>
{% endfor %}
Th开发者_StackOverflowanks..
Use something like jQuery to perform a POST request with the name to another view which will return the new designations as JSON, then replace the returned values into the other select.
精彩评论