Before I get too crazy with custom code, I want to make sure I'm not missing / misunderstanding something. I'm using HidingCheckBox to display either an A or B set of fields. Problem is that A and B are hidden until one actually checks/unchecks the box. I'd like A to display when the Checkbox is unchecked and B when it is checked. Worse, if there is a validation error, the form reloads and all fields are hidden until the user checks then possibly unchecks the box. Even if I pass the value= to the form, and it populates the fields including the checkbox, the right things are hidden until the Checkbox is toggled. Do I need to write my own javascript to hide/unhide based on the checkbox value on document load, or am I missing something?
The form:
class ParticipantNameForm(twd.CustomisedTableForm): action = lurl("/participant/save") submit = twf.SubmitButton() class child(twd.HidingTableLayout): label = None is_company = twd.HidingCheckBox( label="This is a Company", mapping={1: ['org_name', 'tax_id_num', 'org_filing_name', 'org_account_num'], 0: ['salutation', 'first_name', 'mi', 'last_name', 'suffix', 'birthday', 'ssn', 'filing_name', 'nick_name', 'spouse', 'offspring'] } )
salutation = twf.TextField(label='Sal.', validator=twc.StringLengthValidator(max=8)) ......class def continues............
Then in the Controller:
return dict(data=part, page="participant", title="New Participant",
name_form=forms.ParticipantNameForm)
And the Genshi template:
<form name="name_form" method="post" py:replace="name_form.display(value=data)">
<h3>No name form found.</h3>
</form>
Apologies if I missed some important info, but any help would be appreciated.
-Barry