I have simple Accordion below:
I want to setup active=True
or active=False
conditionally basing on value which is on reason_yes
and reason_no
fileds:
def __init__(self, *args, **kwargs):
super(MyUpdateForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.layout = Layout(
TabHolder(
Tab(
'Tab1',
Accordion(
AccordionGroup(
Field('reason_yes'),
active=False
),
AccordionGroup(
Field('reason_no'),
active=True
)
)
),
Tab(
'Tab2',
Field('other fileds')
)
),
FormActions(
Submit('save_changes', 'Save changes', ),
Button('cancel', 'Cancel', onclick="window.history.back()"),
)
)
Finally I ended up with jQuery like below