Ajax Driven Dropdown Lists for ProcessWire made easy

Nomenclature

Before you can start to use Dynamic Selects, it is important to first know the naming conventions used in the module. These are explained below.

Column

A column is synonymous with a dropdown. One cannot exist without the other. In the case of backend use (FieldtypeDynamicSelects), for each dropdown created by the field, a corresponding column is created in the database table of the field for data storage for that specific dropdown.

Column Name

This refers to the name given to a column. It must be all lowercase and in the format a-z0-9

Column Label

This is a user-friendly text that will be used to identify each defined dropdown when editing or viewing a page with a DynamicSelects. In other words, it is the header of the dropdown. It is most likely that the column label will mirror the column name. However, this is not a requirement.

First/Initial Column

For each Dynamic Selects created, there must be at least 2 dropdowns. Irrespective of the number of dropdowns, the first or initial column always refers to the first dropdown in the set of dropdowns. In other words, the dropdown placed at the extreme left when viewing the field's GUI when editing a page containing a Dynamic Selects field or when viewing a frontend Dynamic Selects.

Data Trigger

Data trigger, or simply trigger refers to the dropdown where a change occurs by selecting an option which in turn initiates/precipates the fetching of data to populate another dropdown (known as a dependent dropdown)

Dependent Dropdown

A dependent dropdown is one which is populated by data determined or controlled by changes made in its trigger dropdown. In the example image below, the dropdown Countries has no trigger. The dropdown Cities is triggered by changes that occur in the dropdown Countries. In other words, Cities is dependent on Countries. In turn, Attractions is dependent on its trigger dropdown Cities.

Data Relationship

Data relationship or simply relationship describes how a dependent dropdown and its trigger dropdown are connected/associated. A relationship is always described as how the dependent dropdown/select is related to its trigger dropdown. For instance, in the case of a child page and its parent page, the relationship would be described as Child. The types of relationships possible in FieldtypeDynamicSelects are described in their own topic here.

Data Source

For each piece of data displayed in a dropdown (as the select's <option>), a textual value must be displayed. In our illustrations above, Kenya, Mombasa and Fort Jesus are all textual values. However, each of those values originate from somewhere within ProcessWire, or more correctly, from some table in the database. These could include a field in a page, a property of a user or the label/name of a field or a template. In the previous illustrations, the values are coming from the Title field of the selected pages. However, this is not always the case. The values might as well have come for some text field, or an integer field within a given page. For instance, rather than displaying the title of the page Kenya, one could have chosen to show the value of its country code (KE) as retrieved from its text field country_code. All this and more is possible in the DynamicSelects module. Simply put, the data source is where the value of a piece of data contained within a dropdown originates from. This will be addressed in more detail in the topic looking at setting up Dynamic Selects.

Included/Excluded Templates/Pages/Fields

As will be shown later, Dynamic Selects can display different types of data from multiple sources within a dropdown. In instances where one wishes to only list/display the labels or names of certain templates/pages/fields for selection in a dropdown, using these settings, it is possible to only include or exclude certain templates/pages/fields. A combination of inclusions/exclusions allows fine-grained control of your Dynamic Selects. For instance, it is easy to set up scenarios such as:

The process of setting up inclusions/exclusions is described in detail in later topics.