I would like to create a dialog with three fields and a checkbox. If deselected it must hide the fields, if selected show them. I would also like a version without js.
Solved! Go to Solution.
Views
Replies
Total Likes
You tried and it didnt work? If you can share your dialog xml, can point if any mistakes.
To get started, copy a working dialog from ootb component and edit. Search `cq-dialog-dropdown-showhide-target` at crx, it shows the components implementing showhide. Duplicate the dialog from say /libs/foundation/components/list/cq:dialog/content/items/column/items
and then edit on top.
NOTE: Foundation components are deprecated. Use wcm core components for better reference.
For steps:
Views
Replies
Total Likes
There is no-js option using ootb dropdownshowhide
You need to leverage granite/ui/components/coral/foundation/form/select. Instructions are provided in /libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide/js/dropdownshowhide.js
* - add the class cq-dialog-dropdown-showhide to the dropdown/select element
* - add the data attribute cq-dialog-dropdown-showhide-target to the dropdown/select element, value should be the
* selector, usually a specific class name, to find all possible target elements that can be shown/hidden.
* - add the target class to each target component that can be shown/hidden
* - add the class hidden to each target component to make them initially hidden
* - add the attribute showhidetargetvalue to each target component, the value should equal the value of the select
* option that will unhide this element.
Majority of youtube videos, blogs, explain writing custom showhide.js. But not required. ootb dropdownshowhide should work seamless.
Views
Replies
Total Likes
Thanks for the reply. I have the js, but I don't know how to implement these changes in the dialog. I don't know exactly what to add in the select element and fields.
Views
Replies
Total Likes
You tried and it didnt work? If you can share your dialog xml, can point if any mistakes.
To get started, copy a working dialog from ootb component and edit. Search `cq-dialog-dropdown-showhide-target` at crx, it shows the components implementing showhide. Duplicate the dialog from say /libs/foundation/components/list/cq:dialog/content/items/column/items
and then edit on top.
NOTE: Foundation components are deprecated. Use wcm core components for better reference.
For steps:
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies