/
Example 6 - (Video) - More Dependent Fields
Example 6 - (Video) - More Dependent Fields
Required apps
- Power Custom Fields PRO™ or
- Power Custom Fields™
Use case
Select a country or several countries in a custom field based on a continent selected in another custom field.
Video
Script details
The options for the Continent custom field were taken from the database as well. The following scripts are used in this example:
Continent data source
string[] continents = sql("myDB", "select distinct continent from countries"); return continents;
Country data source
string continent = argv["customfield_10109"]; //the dependent field string[] countries = sql("myDB", "select country from countries where continent = '" + continent + "'"); return countries;
For the moment, dependent fields can only be used by the two custom fields with autocomplete.
From Power Custom Fields PRO™ 4.0.0, you can now use the dependent fields on SQL data sources as well.
In order to get the value set on the screen for one custom field, reference it like this: "argv[customfield_id]".
See also
, multiple selections available,
Related content
Example 4: Configure dependent custom fields
Example 4: Configure dependent custom fields
More like this
Overview of Power Custom Fields
Overview of Power Custom Fields
More like this
Example 3: Use SQL Data Source in custom field configuration
Example 3: Use SQL Data Source in custom field configuration
More like this
Scripting support for Power Custom Fields
Scripting support for Power Custom Fields
More like this
PCF - Multiple Autocomplete
PCF - Multiple Autocomplete
More like this
Overview
Overview
More like this