Show/hide fields based on checkbox in multifield | Community
Skip to main content
November 28, 2024
Solved

Show/hide fields based on checkbox in multifield

  • November 28, 2024
  • 2 replies
  • 1224 views

I have a checkbox in a multifield based on which i want to show/hide certain multifield items. I have tried following the instructions in  (/apps/acs-commons/touchui-widgets/showhidedialogfields/source/showhidedialogfieldstabs.js ) however i cannot get this to work. It only hides my fields on initial load of dialog but upon checking the checkbox it does not show the fields at all. Checkbox checked value is string true. Unsure of what i am doing wrong here.

Node structure for checkbox (enableLinks)

granite:data node for checkbox

 

Show/hide field container properties, it contains a pathfield and select dropdown field 

 

granite:data node for show/hide container

 

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Sure thanks for the prompt replies @arunpatidar  , however is there any reason the acs-commons js not working? I have tried playing with it as well and tried whatever mentioned on the first link.


Hi @zendark 
It’s possible that the ACS Common solution doesn’t cover the multifield use case, as the OOTB dropdown also doesn’t support it. This is why I had to modify the dropdown JS mentioned above to make it work with the multifield.

2 replies

ZendarkAuthor
November 29, 2024

Hey @arunpatidar , i did follow the first link however that was not working for me 
While after implementing the second link code, upon checking a checkbox in any multifield item it copies behaviour to all, i.e, if i enable checkbox in item0 it will enable for item1 as well 

arunpatidar
Community Advisor
Community Advisor
November 29, 2024

Hi @zendark 
I had the same issue with dropdown type then I had to update the script to work with multifield, you can also create your own scrip if nothing works, Example

 

https://www.linkedin.com/pulse/aem-hideshow-drop-down-select-options-more-than-one-values-vikraman/ 

Arun Patidar
Nikhil-Kumar
Community Advisor
Community Advisor
November 29, 2024