Widget hide and show based on checkbox in dialog

kalyan_venkat

15-10-2015

I have a implementation in which my radio button group has to be shown and hide based on checkbox. I have gone through the api but i couldn't find. Can anyone please help me on this. Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

kautuk_sahni

Community Manager

18-08-2020

Option 1: This should be of some help to you: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem6-4-multifield-with-sho...

 

//The show hide functionality is handle by /libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide/js/dropdownshowhide.js

 

If you see the code the target elements are selected based on data attribute and which is common for all the targeted elements within the multifield item. That's why on the selection of one other also getting changed.

 

To handle this you can find the index/position of the multifield item. If dropdown and targeted element both are within the same multifield item then only do show hide for this set of items.

 

Example code:

dropdownshowhide-multifield.js

This code will only be triggered when you have a select field with class or granite:class property with value cq-dialog-dropdown-showhide-multi unlike cq-dialog-dropdown-showhide

 

Option 2:

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/show-hide-dialog-fields-ba...

//You can refer AEM form component (/libs/fd/af/components/aemform). Asset Type (radio button) field has show-hide functionality .