开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜