Extended WC Asia Special Offer 30% OFF! Use coupon WC30

Data Sources

Data sources are used to automatically populate Select, Checkbox and Radio fields as well as any other fields that support data lists (e.g. text fields).

Demo

Examples of using data sources include:

You’ll find the data source option at top of all field data grids.

By default, the data source will be Off. The Off setting allows you to manually edit the data grid to control which items appear in your field.

Here’s how to use a data source:

1. Select Data Source

  1. Click the settings icon of the field you want to use a data source with.
  2. Click on the right most tab in the sidebar (e.g. for a Select field this is called Options)
  3. Use the Data Source setting to select a data source.

WS Form - Data Source - Select Data SourceThe following data sources can be selected:

  • Preset
    Choose from over 25 categorized data sources such as a list of countries or US states.
  • Posts
    List posts, pages or any other custom post types.
  • Terms
    List terms from any taxonomy, also referred to as categories and tags in WordPress.
  • Users
    List users filtered by role.
  • WordPress Filter Hook (Learn More)
    Populate data grids using your own custom PHP code.
  • ACF Field Options (Advanced Custom Fields plugin)
    Pull choices from ACF fields such as select and checkbox fields.
  • Meta Box Field Options (Meta Box plugin)
    Pull choices from Meta Box fields such as select and checkbox fields.
  • Pods Field Options (Pods plugin)
    Pull choices from Pods relation fields.
  • Toolset Field Options (Toolset plugin)
    Pull choices from Tools relation fields.

Once you have selected a data source, the settings for that data source will be displayed.

2. Configure The Data Source

Each data source has its own settings. The Preset data source simply requires that you choose a preset. Other data sources such as Post have many more options that allow you to control and filter the data retrieved.

WS Form - Data Source - Configure

3. Get Data

Once you have configured the data source, you need to retrieve the data. To do this simply click on the Get Data button.

WS Form - Data Source - Get Data

Once the data is retrieved it will be displayed in a preview data grid:

WS Form - Data Source - Preview

In the above example, we retrieved a list of countries using the Preset data source. Because this data is static, WS Form will change the Data Source dropdown to Off and then allows you to edit the data grid. Other data sources such as Post or Term are not editable because they update dynamically according to the posts or terms you have created in WordPress.

WS Form updates data sources in real-time. This means that if you create a select field that lists all users, it will keep that list up to date with all the users you have in your WordPress admin. Likewise if you create a field that lists all of your posts, it will keep that list up to date with all the posts you create.

It is possible to make any data source static and no-longer update automatically by choosing Off as the Data Source . Note that when Off is selected, the data grid will not update automatically if the original source data is changed.

4. Column Mapping (Optional)

Once you are happy with the data you have retrieved you should ensure your column mapping is correct. The column mapping settings are shown underneath the data grid.

WS Form - Data Source - Column Mapping

There are three column mappings to consider:

  • Labels
    Choose which column is used as the label shown to the user on the form.
  • Values
    Choose which column is used as the value stored when a choice is made by the user.
  • Action Variables
    Choose which column is used for displaying a users choice in email notifications and other add-ons or actions.

By default, WS Form will use the first column for each of these settings.

Each time you retrieve new data you should ensure the column mappings are correct.

5. Save

Click Save & Close (or Save if you wish to make further edits) to save your data source settings.

6. Preview

Click the Preview button at the top of the layout editor to preview the form and test the field contain your data source settings.