webform_views_options
Populate Webform options (selects, radios, checkboxes) dynamically using the Views module. Create cascading, dependent dropdowns that react in real-time without custom code or messy database bloat.
Webforms frequently need to display dynamic data—such as a list of content, taxonomy terms, or commerce products. While Webform natively supports basic entity references, it falls short when you need complex filtering, extraction of multi-value fields, or real-time dependent fields (e.g., selecting a "Make" updates the "Model" dropdown). Webform Views Options bridges this gap by turning standard Webform option elements into dynamic, Views-driven data engines.
Features
This module is built on a two-tiered architecture designed for both basic site builders and power users:
- Dynamic View Loading: Populate standard Select, Checkboxes, or Radios elements with results from any Drupal View.
- Cascading Dependencies: Create "daisy-chained" or dependent fields. When a user selects an option in a "Parent" element, the module uses native Drupal Form API
#ajaxto pass that value to your View as a Contextual Filter, instantly repopulating the "Child" element in real-time. - No Entity Bloat: Stop creating fake entities just to generate Webform radios. This module can pull from flat multi-value fields natively via Views.
- Native Webform Support: Because this module extends existing Webform elements rather than creating a proprietary plugin, all native Webform features (like "Other..." textfields, randomization, and validation) still apply to your View-generated options.
Common Use Cases:
- Automotive: Cascading dropdowns for Make → Model → Year.
- Real Estate: Dependent dropdowns for State → County → City.
- Donations & E-commerce: Showing a dynamic list of donation amounts or product variations based on a previously selected campaign.
Post-Installation
Once installed, there is no global configuration page. The functionality is injected directly into your Webform element settings.
- Create a standard Drupal View. Ensure your View outputs the specific fields you want to use as the internal Key (e.g., ID) and the human-readable Label (e.g., Title).
- Go to your Webform and add a standard option-based element (Select, Radios, or Checkboxes).
- In the element's configuration drawer, scroll down to the new Views Options Population fieldset.
- Select your Target View and Display, and type in the machine names of your Key and Label fields.
- (Optional): To create a dependency, enter the machine name of another element on the form into the Parent Element Key field. Ensure your View is configured to accept a Contextual Filter!
Additional Requirements
- Webform (Drupal Core's Webform module)
- Views (Drupal Core)
- No external JS libraries are required. It relies entirely on Drupal's native Form API.
Similar projects
- Webform Dependent Dropdown: This module is strictly limited to hierarchical Taxonomy terms. Webform Views Options allows dependencies based on any data the Views module can query.
- Webform Views: Typically used to embed an entire View (like a grid or table) into a Webform. Webform Views Options specifically extracts data to populate the
#optionsarray of standard form elements. - Webform Remote Select: Requires you to build REST JSON endpoints and introduces HTTP loading delays. Webform Views Options executes queries internally via Views and relies on native
#ajax, providing a much faster, server-validated experience.