Now that Conditional Fields 1.0 is out, we can focus on new features for the next version.

The most common problem with CF is compatibility with non-core CCK modules.
Many patches have been proposed to fix issues with single modules (like Date and Content Taxonomy), but I think that we can't simply add them to the main module, because it would become in brief bloated and unmaintainable.

The best long term solution is to add a plug-in system to CF, so every widget has its own conditional settings that allow it to work. To do this, we need to identify the things that conditional fields needs to know to guarantee compatibility.

My ideas are still not clear on the subject, so contributions – also theoretical – are very welcome.

Comments

peterpoe’s picture

A possible approach was outlined here #227416: Custom conditional fields.

Bilmar’s picture

subscibing - will be available for any future testing if required.
thanks

rburgundy’s picture

+1 subscribing

benone’s picture

+

robby.smith’s picture

+1 this is the last feature stopping me from launching my new website. looking forward to updates

easp’s picture

subscribing

YK85’s picture

+1 subscribing

capellic’s picture

For those looking for a solution and for those contemplating how to build it out, some consideration may give given to the Rules module and how it can solve problems. In my case, I had a controlling field to show/hide a Link field and FileField.

The case and solution are here:
http://drupal.org/node/596612

YK85’s picture

Hello,

I was wondering if all the current compatibility fixes for 2.x is related to the develpment of this plugin system?

Thanks!

peterpoe’s picture

#9: no, they were easy abstractions that do not include any module-specific code. Look what I did for allowed values (copying cck):

/**
 * Find the allowed values for a field
 */
function conditional_fields_allowed_values($field) {
  $function = $field['module'] .'_allowed_values';
  $options = function_exists($function) ? $function($field) : content_allowed_values($field);
  return $options;
}

This isn't only for Content Taxonomy, but also for any other module that uses the convention MODULE_NAME_allowed_values.

clashar’s picture

subscribe

would be super to see the compatibility of Conditional Fields with Multigroup

shopdogg’s picture

subscribe

robby.smith’s picture

hello, I was wondering if there has been any further development in this area?
should we post in drupal module forum for help in this development for conditional fields?
great module and hope to see this module continue to get better!

thanks!

locomo’s picture

+1 would love this functionality.. particularly for imagefield

kscheirer’s picture

How about at least adding support for the standard taxonomy module? That seems like a natural for use as a controlling field.

pdevillo’s picture

Support for standard taxonomies as a controlling field would save my day!

pdevillo’s picture

I would love to have the ability to choose values from multiple controlling fields - right now we are limited to one:
example: if field1 value = a and field2 value = c show the conditional field.

YK85’s picture

Hi Peterpoe,

I was wondering if you have had time to develop the 3.x version you mentioned a few months back?
Really looking for the AND/OR conditional fields support.

Regards

Swipular’s picture

+1 subscribing

achton’s picture

Subscribing too. Any status updates?

davidwhthomas’s picture

I'm looking for taxonomy / content_taxonomy support, any general thoughts on the process / what would need to change to add this support?
Happy to put together a patch.
DT

kenorb’s picture

+1

joeysantiago’s picture

I'd like to have fields depending on taxonomy terms too... :)

Zuzuesque’s picture

Taxonomy support would be awsome. I am more than willing to test too, but I am not good enough coding to help much with patches I am afraid.

huba’s picture

subscribing

zet’s picture

+1 for core user Profile registration/edit fields

jonathanmd’s picture

+1

fourmi4x’s picture

Suscribing, would love to have compatibility with Link module, to solve the "required" problem mentioned here : http://drupal.org/node/549362

fourmi4x’s picture

Ok I've found a quick fix for the problem related to the validation of required non-core conditional cck fields.

It works at least for the Link module, but should work for a bunch of other "CCK field modules" too.

There was 2 problems:
- Error when the required conditional field is not visible (condition has not been triggered), asking for filling it in.
- Error when the required conditional field is visible (condition has been triggered), asking for filling it in.
So basically it was not working at all :)

- First problem can be fixed with http://drupal.org/node/919348#comment-4543638
- Second problem can be fixed by modifying the conditional_fields.module file:
In 6.x-2.x-dev, at line 996, add the lines between the comments:

function conditional_fields_check_empty($field) {
  // Normal fields
  if (isset($field[0]['value'])) {
    $value = $field[0]['value'];
  }
  // Node reference
  elseif (isset($field[0]['nid'])) {
    $value = $field[0]['nid'];
  }
  /** add this **/
  // Link module
  elseif (isset($field[0]['url'])) {
    $value = $field[0]['url'];
  }
 /** end add this **/

  if (!count($value) || (is_string($value) && drupal_strlen(trim($value)) == 0)) {
    return TRUE;
  }
...

With these two fixes I finally get a conditional required link field to work!

Encarte’s picture

subscribe

nclavaud’s picture

same dirty hack for CCK Email Field, works great :

function conditional_fields_check_empty($field) {
  ...
  // Email Field module
  elseif (isset($field[0]['email'])) {
    $value = $field[0]['email'];
  }
  ...
}
Drupa1ish’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes

Version 7.x-3.x-dev works by default with https://drupal.org/project/rolereference and https://drupal.org/project/entityreference ( select list widget tested so far)

kscheirer’s picture

As EuroDomenii mentioned, using 7.x-3x.dev works great with Taxonomy, thanks!

Honza Pobořil’s picture

Is there some guide how to add support for some other widget? Or at least list what should work (to decide if it is for bug report or feature request)?

Honza Pobořil’s picture

Idea: Will be more user friendly if the UI can tell user if this widget is supporter or not.

dqd’s picture

Status: Active » Closed (outdated)

Thanks for the report and all the efforts in here. But due to inactivity in this issue for some years and because of the upcoming EOL of Drupal 7, I will close this issue on the way by cleaning up the issue queue.

Feel free to re-open as "Needs review" if you found a solution or have a patch to be reported to help others on this outdated version.

If you think this issue or missing feature should be addressed in a newer Drupal core 8 and above compatible version of this project, then please file a new issue to the latest dev.