All Show-hide dropdown fields are getting stored at JCR | Community
Skip to main content
June 23, 2023
Solved

All Show-hide dropdown fields are getting stored at JCR

  • June 23, 2023
  • 3 replies
  • 915 views

I've implemented a regular showhide dropdown feature in aem dialog. Show-hide feature is working fine. First I selected first option and authored the fields under that option. Later I selected the second option and authored the fields under second option. But at content page node level both values are getting stored. My requirement is, if I switch the dropdown options from first select option to second select option, whatever the fields authored under first option should not store at content page node level. I'm not looking for any custom implementation. Do we've any OOTB AEM feature to achieve this requirement?

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 aanchal-sikka

Hello @vvenkateshr 

 

With show-hide, the fields still exist in the DOM. They are not cleared. This provides that benefit, that if you have toggled by-mistake, the pre-filled values are not lost.

 

In your code, you would have to check the value of the dropdown, and the decide whether you want to consume/ignore the other fields.

 

Else, you would need to customize to clear the fields, in which case you loose the benefit stated above. For customization, please refer to threads

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/clear-values-in-fields-on-switch-dropdown-values/m-p/436887 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-can-i-clear-data-from-dialog-when-user-picks-a-different/td-p/200286 

3 replies

Tanika02
Level 7
June 23, 2023

Hello @vvenkateshr - 

 

In AEM, there is no out-of-the-box feature specifically designed to handle the scenario you described, where the authored fields under one dropdown option should not be stored at the content page node level when switching to another dropdown option. By default, AEM saves all the values entered in the dialog fields to the content page node when the dialog is saved.

 

However, this can be handled via custom implementations.

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
June 23, 2023

Hello @vvenkateshr 

 

With show-hide, the fields still exist in the DOM. They are not cleared. This provides that benefit, that if you have toggled by-mistake, the pre-filled values are not lost.

 

In your code, you would have to check the value of the dropdown, and the decide whether you want to consume/ignore the other fields.

 

Else, you would need to customize to clear the fields, in which case you loose the benefit stated above. For customization, please refer to threads

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/clear-values-in-fields-on-switch-dropdown-values/m-p/436887 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-can-i-clear-data-from-dialog-when-user-picks-a-different/td-p/200286 

Aanchal Sikka
bilal_ahmad
Level 5
June 23, 2023

Hey @vvenkateshr you can achieve it using this - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/clear-values-in-fields-on-switch-dropdown-values/m-p/436887

or Create a sling model and perform the following operations in author mode only - examine the selected value of a dropdown and remove other values using Node APIs accordingly.

-Thanks

Bilal