Last updated 19 August 2015. Created on 14 July 2015.
Edited by axel.rutz, njbarrett, Konstantin Komelin. Log in to edit this page.

Overview

The Dynamic dependent fields module makes field value or options depend on other field values when editing entity.

The project consists of two modules:

  • Dynamic dependent fields - serves as a core API and adds support of dynamic dependency for options.
  • DDF Entity Reference - a submodule of Dynamic dependent fields module that adds support of dynamic dependency for entity reference fields.

Dependencies

Dynamic dependent fields:

DDF Entity Reference:

Usage

Case 1: Dynamic dependent field with Entity Reference view

  1. Enable both modules from the package (Dynamic dependent fields and DDF Entity Reference).
  2. Create a view with:
    • An Entity Reference display
    • Input/Contextual filter: Your argument-field type, e.g. if you pick from a list of nodes - the content id
    • Output: A list of items you would like to reference to e.g. taxonomy terms
  3. Create two fields
    • Your argument field of whatever type you expect for your entity-reference (e.g. nodes) view (Cardinality of this field must be 1 as of now - feature request is pending)
    • For the dependent field create an field of the type Entity Reference; for the entity selection choose Views: Filter with an entity reference view with dynamic arguments as a selector (Note: This is the view that will take your contextual argument, if it doesn't appear on the list the target type doesn't match)
    • Below this field you will see a list of Dynamic arguments; these are possible argument fields. If your field is not listed check the cardinality and type of this argument field.

Limitations

Known issues

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

vlyalko’s picture

THis module is working great for the authenticated user and throwing an ajax error for anon user on the registrations form.

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /ddf/update/field_primary_program_area/user/user/NULL
StatusText: OK
ResponseText:

Any help will be appreciated.

Thank you,

caldenjacobs’s picture

vlyalko, I'd recommend opening a ticket with the above description in the DDF issue queue: https://www.drupal.org/project/issues/ddf