What I need to do is hide or show a text field (may be many more fields in the future) based on an option I select in another dialog. Let's say there are two dialogs A and B. There is a dropdown in dialog A which has two options 'Hide' and 'Show' and a textfield in dialog B. If I choose 'Show' from dialog A, a field in dialog B should be made visible the next time I open dialog B. If I choose 'Hide' from dialog A, then that field must be hidden in dialog B. The field in dialog B needs to be hidden by default. In such a way, is it possible to hide or show fields in dialogs based on selections in other dialogs? Currently developing in AEM 6.4.
i create something of similar for a project. In my case i use java code in order to change the dialog.
I attach here an example.
If i can suggest you, after using this way i think that it's better to change the design of your components in order to avoid this kind of behaviour.
It's better that elements of a dialog that are related, are configured in the same dialog. If you need to make this configuration because you have a "container" and elements configured for this container, is better that you try to create just only one dialog or manage this configuration by using page property (if it's possible).
YOu can write JQUery code to manipulate fields on the same dialog. For 2 different dialogs - never seen that uses case. However - i passed this to our Touch UI team to get their thoughts. (but best practice is 1-1 - all fields are on 1 dialog and have nothing to do with other dialogs)
I'm not sure of the requirements that you have but in order to achieve your use case, you would need to persist & cleanup the state of those fields either in JCR node/json or in browser via cookie/localStorage/sessionStorage etc. The reason is because you want to perform certain actions that are outside the scope of your original request in a stateless architecture.
You would definitely need to consider the end-to-end design when concurrent users may want to interact with the system, probably same page/same component use cases.