The List module defines various fields for storing a list of items, for use with the Field module. Usually these items are entered through a select list, checkboxes or radio buttons. This module is an internal element of the Field API.
List module defines and creates interface elements for select lists, checkboxes and radio buttons used by the Field UI. When creating new fields for content nodes or users, you may use the four basic list options when creating fields:
- List - The default list type, a simple selection of text options, for example:
This field type stores values based on the order of each item. Altering the options after creating the field can result in lost data. These values may not have optional display labels. To use labels with named keys, select the List Text field format.
- Boolean - Creates a single yes/no option. When creating this field, you may select two radio buttons or a single on/off checkbox. When creating boolean fields, you supply labels for the on and off states. Note that changing the labels after creating the field will not affect existing data.
- List (numeric) - Creates a list of items with associated numeric keys, such that the order of elements does not matter for data storage. This type is suitable for most lists, as it allows human-readable labels, for example:
These labels may contain limited HTML for formatting the forms created by your field. Changing the labels after creating the field is acceptable. Changing the numeric keys may result in a loss of data.
- List (text) - Creates a list of items with text keys for data storage. These lists are useful for storing data which has meaningful text keys, such as the abbreviations of countries:
These labels may contain limited HTML for formatting the forms created by your field. Changing the labels after creating the field is acceptable. Changing the text keys may result in a loss of data.
Entering field options
When entering field options, you are creating a list that Drupal can present to your users. Each element in the list is defined by a linebreak, so you must enter one item per line.
Canada, Mexico, United States
About field labels
Field labels are used to provide human-readable form elements. The keys of each key|label pair are stored in the database, while the labels are displayed to site users. When entering keys and labels, use the pipe character | to separate the key from the label.
Labels may contain limited HTML to improve form readability. For example, you may provide help links for an item or use emphasis:
CA|Canada (<a href="http://en.wikipedia.org/wiki/Canada">Wikipedia entry</a>)
This module was introduced in Drupal 7.
CCK in Drupal 6 and lower
In Drupal 6, list field behavior was defined by the contributed CCK module.