Plone 4.3.3
PloneFormGen 1.7.16
I would like to display or hide a set of fields based on the user's selection from a Selection field. The Fieldset Begin and Fieldset End elements do not answer this, so I am left with an Overrides Enabling Expression for each field. What is the TALES incantation for testing the current value of a form field? Will PloneFormGen dynamically test so that the fields are shown/hidden upon the user changing the selection?
Thank you,
Chuck
This can be done with JavaScript: 1 and 2.
First create JavaScript file to the forms folder:
Sample js to hide field based on the selection of an another field (modified from 2): (Note: requires selection-list field)
Second inject the js to the form's header:
Third (optional) make the dynamically hidden field required only when it is visible.
In Overrides tab, add a custom field validator:
python: test(request.form['selection-fieldname'] != 'I like this' or value, False, 'Required when I like this is selected.')