Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

Level 3

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!!!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Community Advisor

@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-...

 

Avatar

Level 3

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

Avatar

Correct answer by
Community Advisor

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