Alchemy Options Docs
v1.0
v1.0
  • Read Me
  • Installation
  • Configuration
  • Meta Boxes
  • Samples
  • Field types
    • Text
    • Password
    • URL
    • Email
    • Tel
    • Textarea
    • Editor (WYSIWYG)
    • Datepicker
    • Image upload
    • Radio buttons
    • Select
    • Checkbox
    • Colorpicker
    • Image radio
    • Post type select
    • Datalist
    • Sections
    • Repeater
    • Button group
    • Slider
    • Taxonomy select
    • Field group
  • Functions
    • alch_options_id
    • alch_network_options_id
    • alch_get_option
    • alch_get_network_option
    • alch_delete_value
    • alch_get_post_meta
  • Javascript
    • getOption
    • getNetworkOption
    • getPostMeta
  • Filters
    • alch_options_id
    • alch_default_page_capabilities
    • alch_default_page_icon
    • alch_default_page_position
    • alch_network_options_id
    • alch_options_id() . '_args'
    • alch_network_options_id() . '_args'
    • alch_allowed_editor_html_tags
    • alch_allowed_editor_protocols
    • alch_{ $optionsPageID }_capabilities
    • alch_{ $optionsPageID }_icon
    • alch_{ $optionsPageID }_position
    • alch_value_{ $optionID }
    • alch_network_value_{ $optionID }
Powered by GitBook
On this page
  • Example configuration
  • Multiple choice
  • Params
  1. Field types

Datalist

PreviousPost type selectNextSections

Last updated 6 years ago

Datalist field renders a searchable field. Handy when the number of options is rather big (e.g. A list of countries in a regular may arguably not be a good UX). Supports .

Example configuration

...
array(
    'title' => 'My datalist field title',
    'id' => 'first-datalist-option',
    'desc' => 'Short description for the field',
    'tab' => 'main',
    'type' => 'datalist',
    'options' => array(
        array(
            'name' => 'Name one',
            'value' => 'Value one',
        ),
        array(
            'name' => 'Name two',
            'value' => 'Value two',
        ),
        array(
            'name' => 'Name three',
            'value' => 'Value three',
        ),
    ),
),
...

This will produce the following

Multiple choice

...
array(
    'title' => 'My datalist field title',
    'id' => 'first-datalist-option',
    'desc' => 'Short description for the field',
    'tab' => 'main',
    'multiple' => true,
    'type' => 'datalist',
    'options' => array(
        array(
            'name' => 'Name one',
            'value' => 'Value one',
        ),
        array(
            'name' => 'Name two',
            'value' => 'Value two',
        ),
        array(
            'name' => 'Name three',
            'value' => 'Value three',
        ),
    ),
),
...

will result in the following

Params

Name

Type

Description

type

string

datalist (required)

id

string

Unique ID that will be used to retrieve the value (required)

tab

string

Specifies in which tab this option will be rendered

title

string

Shows a heading to the left of the field

desc

string

Shows a description text (can have HTML)

multiple

boolean

options

array

if 'multiple' => true is added to the , the field will respect it. The following configuration

Set to true if multiple values are needed. See above.

Array of arrays with value and name keys. See above.

Select 2
Select field
multiple choice
configuration object
an example
examples