开发者

Django: multiple dynamic comboboxes

开发者 https://www.devze.com 2023-01-07 22:13 出处:网络
Does anyone know how to link two ComboBoxes which are generated from a form in a way that makes the second ComboBox dependent on开发者_开发问答 the first one?

Does anyone know how to link two ComboBoxes which are generated from a form in a way that makes the second ComboBox dependent on开发者_开发问答 the first one?

Every time the user would change the selection in ComboBox #1, the options in ComboBox #2 would change to a predefined list of options. The potential options for both comboboxes are fixed at time of generating the html file.

Thanks for any help.

Cheers, Max.


Use javascript to get selected options of #1, process the list and change #2 according to it.

With jQuery it's not that hard.

Use

$('select#id_of_1 option:selected').val();

to get the list of selected options and process this list afterwards.

0

精彩评论

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

关注公众号