我有一个网页,我希望用户只从三个中的任何一个列表中选择项目。
A B C
-A1 -B1 -C1
-A2 -B2 -C2
-A3 -B3 -C3
现在,用户必须只选择A,B或C中的项目(多个),而不能选择多个列表。例如:A1,A2,A3可以从A中选择,但是当选择B时,必须取消选择A下的项目。 我想知道HTML或WTForms中是否存在这样的表单
答案 0 :(得分:1)
If it has to be pure HTML, you'll have to take two steps. I think you might be talking about three Comboboxes. They are generated with the select command.
<select name="A">
<option value="A1">A1</option>
<option value="A2">A2</option>
</select>
To make only one of the three comboboxes active you could use a radio button set above:
<form>
<input type="radio" name="list" value="A" checked> A<br>
<input type="radio" name="list" value="B"> B<br>
<input type="radio" name="list" value="C"> C
</form>
then change the visibility of the Comboboxes based on the radio button picked.