MetadataDropdown - adobe-dmeservices/custom-metadata GitHub Wiki
Dropdown Fields
Dropdown fields allow users to select one value from a menu. Dropdown fields require an array of options, which you configure in the Options tab.
Options can be a simple array of text values or an array of objects that specify the label and value separately. The menu will display the labels when available and will write the corresponding value to XMP. In this example, the menu will display "dog," "cat," and "bird."
["dog", "cat", "bird"]
You can also provide a label for each item to make it easier to read or if your users are familiar with another term for the value. Format your array to include label
and value
pairs for each item. The dropdown will show the label
in the menu, but it will read and write the value
from XMP. For example, this JSON makes a Dropdown for a field called Pet Type that describes the kind of pet in the photo.
[
{ "label": "Doggy", "value": "dog" },
{ "label": "Kitty", "value": "cat" },
{ "label": "Birdy", "value": "bird"}
]
Dependencies
You can optionally use Dependencies to set one or more fields that must have data before a user can enter data in this field. This field will be disabled until there is a value present in the field you specify in Dependencies. For instance, you might want to disable the Breed dropdown until the Pet Type dropdown has a value. Learn more about Dependencies
- To configure, choose one or more fields from the Dependencies dropdown in the Advanced tab. The dropdown will display all currently defined fields, so you will need to define fields before you can use them as Dependencies for other fields.
Filter Options
You can use Filter Options to specify one field whose value will be used to filter the values in your dropdown. Filter Options are defined by the parent
key. You can use a single text value or an array of acceptable values, and the values must exactly match the value
, not the label
, from the field you choose in Filter Options.
For example, if you had a Dropdown field called Pet Type with values "dog", "cat" and "bird", you could make a second field called "breed" that uses Pet Type to filter its options based on the value of pet
. When the user selects "cat" as the breed, the menu defined below would show "Maine Coon" and "Other," because those have "cat" in their parent.
[
{
"label": "Schnauzer",
"value": "schnauzer",
"parent": "dog"
},
{
"label": "Maine Coon",
"value": "maine_coon",
"parent": "cat"
},
{
"label": "Parrot",
"value": "parrot",
"parent": "bird"
},
{
"label": "Other",
"value": "Other",
"parent": ["dog", "cat", "bird"]
}
]
You can also enable Auto select when filtered. This will automatically select one option when the filtered options reduce to only one choice. This can help with data entry, especially when there are dependent Fields.
Multi-Dropdown Fields
Multi-Dropdown fields allow users to select multiple value from a menu. It has all of the same configuration options as a Dropdown, with two additional configuration options.
You can enable users to enter their own values outside of the option list. To enable this feature, enable Allow User Defined Values on the Basic tab.
Multi-Dropdown stores selected values in an array. It uses a Bag by default, however you can switch between Bag and Seq using the Array Type menu on the Advanced Tab.
Selection Groups for Multi-Dropdowns
You can use Selection Groups with Multi-Dropdown Fields to connect one or more items together to make bulk selection easier. Selection Groups are defined by the group
key, and they require an array. When a user selects an item, all items whose group
matches the selected item's value
will also be selected. Selection Groups are common when certain values are usually selected together, such as product families or related items.
For example, if a user selects "All Dogs" from the dropdown defined below, the value
will be [all dogs,schnauzer,doberman,chinook]
because all of those items have all dogs
as their Group selector. Groups can contain more than one value in the array, so items can belong to one or more selection group.
[
{
"label": "All Dogs",
"value": "all dogs",
"parent": "dog",
"group": ["all dogs"]
},
{
"label": "All Cats",
"value": "all cats",
"parent": "cat",
"group": ["all cats"]
},
{
"label": "Schnauzer",
"value": "schnauzer",
"parent": "dog",
"group": ["all dogs"]
},
{
"label": "Doberman Pinscher",
"value": "doberman",
"parent": "dog",
"group": ["all dogs"]
},
{
"label": "Chinook",
"value": "chinook",
"parent": "dog",
"group": ["all dogs"]
},
{
"label": "Maine Coon",
"value": "maine_coon",
"parent": "cat",
"group": ["all cats"]
},
{
"label": "Persian",
"value": "persian",
"parent": "cat",
"group": ["all cats"]
},
{
"label": "Parrot",
"value": "parrot",
"parent": "bird",
"group": ["all birds"]
},
{
"label": "Chicadee",
"value": "chicadee",
"parent": "bird",
"group": ["all birds"]
},
{
"label": "Other",
"value": "Other",
"parent": ["dog", "cat", "bird"],
"group": ["Other"]
}
]