http://adobeaemclub.com/toggle-fields-based-on-selection-in-granite-ui-dialogs/
http://stackoverflow.com/questions/25244844/conditional-show-hide-of-fields-in-aem-6-dialogs
However, OOTB client-library doesn’t cater some very common use case ie show a particular field for more than one option in the dropdown.
For this use case add a custom hide/show JS available here.
Points to remember while implementing the dialog using the custom hide/show JS.
- Multiple option values can be added on the field
separated with a white space to cater to the use case of showing a field for
multiple options of selection.
- Atleast One field needs to have all the option
values. This can be a field which is never hidden for any of the options else
sometimes the entire tab doesn’t show up. Eg.
/apps/project/components/content/base-
list/cq:dialog/content/items/links/items/column/items/orderBy. - There are some issues with hiding input labels in such case so it might be good idea to wrap the field into the section (granite/ui/components/foundation/well)