Dropdown field

Select a value from a dropdown list of values.

Return value

String with internal value representing the selected value. This value will be the same no matter if the value is renamed of moved within the dropdown.

If dropdown is of type multiple then return value is an array of strings.

Extended Return Values

The recommended way, gives you more information, including the selected dropdown value in clear text.

If dropdown is of type multiple then the returned value will be an array with each selected value as an extended return value, like below, but with arrays.

Example


// Field slug is "dropdownExample"
// The value returned may be a bit wierd.
// Please check out field type radio buttons for more info.
$selected_dropdown = simple_fields_value('dropdownExample');
if ($selected_dropdown == "dropdown_num_2") {
    echo 'Thanks for selecting me, the dropdown with the text "Dropdown val 1"';
}

Output of above:

Thanks for selecting me, the dropdown with the text "Dropdown val 1"!

3 thoughts on “Dropdown field

Leave a Reply