I'm hoping there's a rocket scientist out there that can help me with this!!

I am using the following entities:

  • Machine Type (Taxonomy)
  • Ink Type (Taxonomy)
  • Ink Configurations (Taxonomy)
  • Machine (Content Type)
  • Customer Machine (Content Type)

The Machine Type, Ink Type & Ink Configurations taxonomies have an Entity Reference field added to them which references the Machine content type.

The Machine content type has entity reference fields for Machine Type, Ink Type & Ink Configurations.

I'm using Corresponding Entity References on the Machine content type & the 3 associated taxonomies to keep the references bi-directional.

The Customer Machine content type has the following fields (partial list): - Customer (Entity Reference) - Machine Type (Entity Reference) - Machine (Entity Reference with Reference Field Option Limit by Machine Type) - Ink Type (Entity Reference with limit by Machine) - Ink Configuration (Entity Reference with limit by Machine)

The user should first select the Customer, followed by the Machine Type. Selecting the Machine Type should filter the available Machines. Selecting the Machine should filter the Ink Type & Ink Configuration options.

All of this works as it should but then I tried to add Conditional Fields to the process.

The Ink Type & Ink Configuration settings should only be visible when certain Machine Types are selected as some Machine Types do not make use of ink.

When you choose the Machine Type, the Machine entity reference gets limited as desired but when you select a Machine, it exposes the Ink Type & Ink Configurations field regardless of the Machine Type selected.

If I remove the Reference Option Limits on the entity reference fields then the Conditional Fields module works as intended.

I'm guessing I could try adding each Machine to a new Conditional fields dependency but this makes maintenance a problem as I would need to modify the dependency each time a new machine gets added.

Sorry for the long post but I'm hoping that clarifies the details of my scenario.

I'm using: - Drupal 7.3x - Conditional Fields 7.x-3.0-alpha1 - Reference Option Limit 7.x-1.x-dev (latest at time of writing)

I have also applied this patch to Reference Field Option Limit so that multiple fields can react to the same filtering field. In this case both Ink Type & Ink Configuration react to Machine.

Any assistance in this regard would be most appreciated because I'm somewhat clueless when it comes to module development & troubleshooting!!

So far, I've made a basic module that uses hook_form_alter to change the cardinality of the Ink Types & Ink Configurations fields by setting #multiple to false on the Create Customer Machine form but removing/disabling my module has no impact on the above scenario.

Just off the top of my head... Could Rules and/or Rules Forms Support be of assistance here?

Please help the noob!! :)

Unfortunately I can only post 2 links being a new member.

All of the module URLs start with https://drupal.org/project/ and end with their short names as below:

  • entityreference
  • cer
  • reference_option_limit
  • conditional_fields
  • rules
  • rules_forms
  • Just a note, but if you would use views drupal.org/project/views for the display you can add relations for reversed references (so you would not have to reference in a circle). – Neograph734 Dec 10 '14 at 11:26
  • @Neograph734 Thanks for your input... I know I can do this for actual view displays but I'm trying to deal with the filtering of options on the node/add & node/edit forms. I know you can use Views for your entity reference filter but it requires passing the Contextual Filter parameters via the URL which means the user would first need to navigate to a page with customised links that can pass URL parameters along to the node/add or node/edit form pages. I'd like to avoid undesirable steps that would involve navigating through additional pages etc. – zee86 Dec 10 '14 at 11:36
  • I understand, but don't have experience with conditional fields. Since you seemed to worry about maintenance I just wanted to share this with you ;) – Neograph734 Dec 10 '14 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.