Expand my Community achievements bar.

Show hide JS on dropdown for multiple values

Avatar

Level 2

Can i use the JS at /libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide/js/dropdownshowhide.js for multiple values of the same dropdown.

For eg: I want a container to be shown when val1 is selected and also when val2 is selected in the dropdown. I have tried comma separating however this does not seem to work as per the blog at https://www.linkedin.com/pulse/aem-hideshow-drop-down-select-options-more-than-one-values-vikraman/

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Community Advisor

Hi @Zendarkke 

 

If your AEM cq:dialog structure is similar to what is expected for the custom JS to work, it should execute as expected

 

Debug the custom JS and compare the cq:dialog structure that aligns with the script

 

Thanks

Avatar

Community Advisor

Hi @Zendarkke 

You need to create a clientlibs with category 'cq.authoring.dialog' with below updated js

https://github.com/arunpatidar02/aem63app-repo/blob/master/js/dropdownshowhide-multifield-multivalue... 

 

Please check the usage instructions in the first comment section of the above js file



Arun Patidar

Avatar

Community Advisor

/libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide/js/dropdownshowhide.js supports showing or hiding fields based on a single dropdown option, it doesn't account for multiple selections. To achieve that functionality, a custom JavaScript solution is required.

You can check this: https://ms-29.com/aem/sites/show-hide-aem-dialog-fields-on-dropdown-selection