Using django forms/formsets how do I construct a template that a user can toggle each rendered form in the formset to only display half of the form?
For example each form has a true and a false set of inputs and the user will only want to see one set of inputs at a time (to avoid overloading the user and the view). The user would click on an image with an onclick to toggle between entering data for the true or false set of inputs.
I can see how to do this without django forms but with them I'm a bit confused. Specifically, each field will have its own id that I would need to know in order to toggle the input type from text to hidden.
class ExampleForm(forms.ModelForm):
class Meta:
model = Example
fields = (
'true_input01',
'true_input02',
'true_input03',
'true_input04',
'false_input01',
'false_input02',
'false_input03',
'false_input04',
)
OK, so I wasn't able to come up with an answer to this problem but I did find a work around, which is to toggle the display of a row.
<tr id={{ form.instance.tag_id }}F style="display:table-row">