Steps to Reproduce:

  1. Add a new List (Text) field to the Basic Page content type (field_choose_yes_to_see)
  2. Add two options "Yes" and "No"
  3. Add conditional visibility for the Body Field when the value of field_choose_yes_to_see is "Yes" using the "Values input mode" "All these values (AND)..."

Expected Result:

On the /node/add/page form, selecting Yes for the field field_choose_yes_to_see should show up the Body field.

Results Obtained:

On the /node/add/page form, selecting Yes for the field field_choose_yes_to_see does not show up the Body field.

Comments

nettantra created an issue. See original summary.

hyscaler’s picture

Title: Conditional Fields not Showing up on Select Fiels » Conditional Fields not Showing up on Select Fields
Issue summary: View changes
hyscaler’s picture

StatusFileSize
new6.88 KB
hyscaler’s picture

Status: Active » Patch (to be ported)
rootwork’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

I don't know enough about this to review, but the status should be needs review, not patch to be ported (that's used for porting a patch from one major version to another, like say from Drupal 8 to Drupal 7).

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: issue-2873406.patch, failed testing.

rootwork’s picture

Status: Needs work » Needs review
StatusFileSize
new7.97 KB
new531 bytes

Adding the missing test group.

hyscaler’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 7: conditional-fields_select-fields_2873406-7.patch, failed testing.

eric.chenchao’s picture

eric.chenchao’s picture

Title: Conditional Fields not Showing up on Select Fields » Conditional Fields not Showing up on Select Fields with option 'All these values (AND)...'
rootwork’s picture

bluestatedigital’s picture

Re-rolled the patch in #7 and resolved conflicts in OptionsButton.php and conditional_fields.api.inc.

bluestatedigital’s picture

Status: Needs work » Needs review
colan’s picture

Status: Needs review » Needs work

Patch no longer applies to HEAD so it needs a reroll (assuming it's still an issue). Also, there are coding standards problems:

+++ b/conditional_fields.api.inc
@@ -424,11 +424,13 @@ function conditional_fields_evaluate_dependencies($dependent, $form, $form_state
+    if(is_array($dependent['field_parents']) && count($dependent['field_parents']) > 0) {

There must be a space after "if" here and in other stanzas.

+++ b/conditional_fields.api.inc
@@ -672,7 +678,9 @@ function conditional_fields_evaluate_dependency($context, $values, $options) {
+    if(!empty($values_array) && end($values_array) == "")
+      array_pop($values_array);

Anything inside of an "if" must be surrounded by squiggly braces, here and in other stanzas.

+++ b/src/Plugin/conditional_fields/handler/DefaultStateHandler.php
@@ -47,7 +49,9 @@ class DefaultStateHandler extends ConditionalFieldsHandlerBase {
+        $values_array = preg_split('/\R/', $options['values']);
+        if(!empty($values_array) && end($values_array) == "")
+          array_pop($values_array);

I'm seeing this stanza duplicated in several places. It should be moved to its own method to prevent such code duplication.

`

colan’s picture

Priority: Critical » Major

Downgrading priority as other features work. "Critical" means that the module is completely unusable.

dqd’s picture

Version: 8.x-1.x-dev » 4.x-dev
Priority: Major » Normal
Status: Needs work » Postponed (maintainer needs more info)

Is this issue still relevant for 4.x dev (Drupal 10)? Drupal 8/9 EOL. So: Would like to collect some thoughts/reports here to know how to go on.