Ajax Driven Dropdown Lists for ProcessWire made easy

Column Settings: Data Source

As discussed earlier, for any given dropdown, its value must come from somewhere. These can be either a field or the name or label of a template or a user.

The data source setting is configured by selecting from the options in the select dropdown in the HTML table. For the first dropdown, the data source must always be Initial*.

The rest of the options in these setting is a list of all compatible fields as well as 5 other pre-set data sources. Where a data source is one of those compatible fields, that is referred to as a named-field. For instance, if the data source was Integer, that would mean the named-field is Integer and that its values for respective pages would be the values returned for that dropdown.

The 5 pre-set data sources are:

  1. Initial: Only applicable to the first dropdown. In other words, Initial must always be the data source for the first dropdown*.
  2. Fields: Field relationships must always have their data source as Fields.
  3. Varies: If a trigger dropdown's relationship is Field the data source of its dependent dropdown must always be Varies. This is because the value returned varies depending on the field selected in the trigger dropdown.
  4. User: Properties. This must always be the data source for the relationship User: Property.
  5. User: Varies. Similar to Varies above in #3 but for cases where the trigger relationship is User: Property.

For pre-sets 1, 2 and 4, invalid data sources will be grayed-out and will not be selectable (i.e. from within the data sources select lists in the columns settings HTML table)

In addition, please note that Group relationships can only have pagefields as their data source. If you select such a relationship for a dropdown, your will only be able to select pagefields as data sources in the select list in the HTML columns settings table.

All invalid data sources will throw an error with an explanation of what needs to change.

*Please note that for the first dropdown (equivalent to the first row in the columns settings HTML table), the data source Initial means that if the earlier set First Column Data Source is Pages, the titles of the pages are displayed as values in the first dropdown. If Template, the label or name of the templates are displayed. If Users, the title or name of the users are displayed.