How can I clear data from dialog when user picks a different option from dropdown? | Community
Skip to main content
New Participant
August 2, 2022
Solved

How can I clear data from dialog when user picks a different option from dropdown?

  • August 2, 2022
  • 2 replies
  • 1196 views

Hi all,

 

I am working on a component which has show-hide fields based on dropdown value author select. Now, the issue is that if I enter data for particular fields (let's say fields for this value of dropdown are in container A) after selecting value from dropdown and then selecting another value from dropdown and again entering data in the fields(let's say fields are different and are in container B), it is saving all the values instead of fields which are appearing based on dropdown. I want save the values only for the fields based on dropdown selection and if there are already any values saved that should be removed from the repository as well. How can I achieve this functionality? If there is already a solution available please do share.

 

Thanks in advance!!!

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 Manu_Mathew_

@jangra98 There are many solutions using custom js- one such eg: https://aemhints.com/2020/11/02/show-hide-fields-in-aem-dialog/

 

2 replies

Manu_Mathew_
Manu_Mathew_Accepted solution
New Participant
August 2, 2022

@jangra98 There are many solutions using custom js- one such eg: https://aemhints.com/2020/11/02/show-hide-fields-in-aem-dialog/

 

Jagadeesh_Prakash
New Participant
August 2, 2022

@jangra98  : You should have done written custom JS to achive this functionality. When you are changing the dropdown make sure to reset the values from JS

 

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

 

Jangra98Author
New Participant
August 2, 2022

@jagadeesh_prakash  I checked that post as well but the links provided in there are not working anymore.