# How to control dependent PopupMenus?

I created three interdependent PopupMenus with names demographic, region and custom:

DynamicModule[{demographic = "Demographic", region = "Region", custom = "Custom"},
Dynamic@Grid@{{
}}]


These controls should depend on each others' values. I want the followings:

1. region and demographic should be reset to "Region" and "Demographic" if any from custom is selected

2. custom should be reset to "Custom" if either demographic or region is changed

I tried it with If and Which but it still won't work. How can I control these three PopupMenus?

-
It is always a good idea to try to make your code samples that show the behaviour in question, as short as you can. –  Rojo Dec 11 '12 at 18:46
I think you will probably find answers to similar problems have already been posted here ...but most likely this can be done within the second argument to Dynamic –  Mike Honeychurch Dec 11 '12 at 20:59
@Subbu I've greatly simplified your question: most of it was just styling and sugar. You would get much faster and better answers if you were to put more effort into disassembling your problems to the core. In this case, it could even have been reduced to a two-interrelated-controller problem using the second argument of Dynamic of which here and here are a few answers. (yes I am aware of the date) –  István Zachar Apr 9 '13 at 12:31

You have to use the second argument of Dynamic. Any function put there will be evaluated whenever the controller is changed, so it is quite straightforward to include the resetting of the other popup menus:

DynamicModule[{demographic = "Demographic", region = "Region", custom = "Custom"},
Dynamic@Grid@{{