Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 2

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
Level 7
3 Replies

Avatar

Level 6

@Buland  : 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 2

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

Avatar

Correct answer by
Level 7

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