Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

DynamicModule[{demographic = "Demographic", region = "Region", custom = "Custom"},
     PopupMenu[Dynamic[demographic], {"Demo1", "Demo2", "Demo3"}, "Demographic"],
     PopupMenu[Dynamic[region], {"Region1", "Region2", "Region3"}, "Region"],
     PopupMenu[Dynamic[custom], {"Custom1", "Custom2", "Custom3"}, "Custom"]

enter image description here

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?

share|improve this question
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[demographic, (demographic = #; custom = "Custom") &],
     {"Demo1", "Demo2", "Demo3"}, "Demographic"],
     Dynamic[region, (region = #; custom = "Custom") &],
     {"Region1", "Region2", "Region3"}, "Region"],
     Dynamic[custom, (custom = #; demographic = "Demographic"; region = "Region") &], 
     {"Custom1", "Custom2", "Custom3"}, "Custom"]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.