Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
A version of PopupMenu that provides an InputField to enter "other" values
ResourceFunction["PopupMenuOther"][Dynamic[var],{val1,val2,…}] creates a PopupMenu with an extra "Other…" item which displays an InputField for the user to fill. | |
ResourceFunction["PopupMenuOther"][Dynamic[var],{val1,val2,…},label] uses label as the label for the extra item. | |
ResourceFunction["PopupMenuOther"][Dynamic[var],{val1,val2,…},label→contents] accepts input of type contents. |
A popup menu for a user to indicate how they heard about a service:
In[1]:= |
Out[1]= |
If the user selects “Other…” an InputField appears for them to provide more detail:
In[2]:= |
Out[2]= |
You can change the label for the "other" item:
In[3]:= |
Out[3]= |
By default the InputField interpret the contents as a String but other types available to InputField can be used:
In[4]:= |
Out[4]= |
All standard options for PopupMenu and InputField are supported. For example, use FieldHint to prompt the user:
In[5]:= |
Out[5]= |
If the option is valid for both PopupMenu and InputField, its value will be used by both:
In[6]:= |
Out[6]= |
This work is licensed under a Creative Commons Attribution 4.0 International License