Mathematica Mathematica conditional input field

AI Thread Summary
The discussion focuses on creating a dependent drop-down menu in Mathematica, where the second menu's options are contingent on the selection made in the first menu. The user seeks assistance in implementing this functionality, specifically using an example where selecting a continent in the first drop-down leads to a corresponding list of countries in the second. A code snippet is provided, demonstrating the use of Dynamic and PopupMenu to achieve this interactivity. The solution is confirmed as effective and appreciated by the user.
iva_bg
Messages
8
Reaction score
0
Hello,

I need help constructing a drop-down menu in Mathematica with options depending on the selection from a previous drop-down menu. The example is first the user selects a continent, and then the second drop-down menu shows the respective countries.

Any help would be much appreciated.
 
Physics news on Phys.org
Is this the type of thing?

Row[{PopupMenu[Dynamic[pop1], {"123", "abc"}],
Dynamic[PopupMenu[Dynamic[pop2], If[pop1 === "123", {1, 2, 3}, {a, b, c}]]]
}]
 
Yes, that is great, thank you :)
 

Similar threads

Replies
1
Views
2K
Replies
1
Views
2K
Replies
8
Views
4K
Replies
3
Views
4K
Replies
2
Views
3K
Replies
2
Views
3K
Replies
104
Views
6K
Replies
4
Views
9K
Back
Top