157
rated 0 times
[
158]
[
1]
/ answers: 1 / hits: 16103
/ 11 Years ago, thu, february 28, 2013, 12:00:00
I have a form in Django:
views.py:
class SearchForm(forms.Form):
type = forms.ChoiceField(choices = ...)
list1 = forms.ModelMultipleChoiceField(...)
list2 = forms.ModelMultipleChoiceField(...)
home.htm:
<td valign='top'>{{ form.type }}</td>
<td valign='top'>{{ form.list1 }}</td>
<td valign='top'>{{ form.list2 }}</td>
<td valign='top'><input type=submit value=Find /></td>
I want the list1 element to be shown and the list2 to be hide if type is 1 and vice versa in case type is 2. I want them to be hide and shown dynamically without reloading the page or any interaction with the server.
I believe Javascript could be useful here, but I don't know it.
More From » django