Field Group Conditional State does not work after upgrade

by Amit Sedai   Last Updated April 16, 2018 05:07 AM

After recent upgrade of fieldgroup module, the conditional state visibility for field group does not work now.

Please find the previous code that used to work:

function ji_custom_field_group_build_pre_render_alter(&$element) {

  //BioChemistry
  if(isset($element['group_tr_biochemistry'])){
    $element['group_tr_biochemistry']['#states'] = array(
      'visible' => array(
        ':input[name="field_tr_test_ref[und]"]' => array('value' => 12),
      ),
    );
  }


  //CBC
  if(isset($element['group_tr_cbc'])){
    $element['group_tr_cbc']['#states'] = array(
      'visible' => array(
        ':input[name="field_tr_test_ref[und]"]' => array('value' => 15),
      ),
    );
  }
}

However this does not work after the upgrade. I get an PHP notice instead:

Notice: Undefined index: #id in drupal_process_states() (line 4651 of /srv/www/www.example.com/public_html/includes/common.inc).

Do let me know the workaround possible. Thanks.

Tags : javascript


Answers 3


Searched for some time. Tried different options. Finally reverted to older version 1.3 and it worked just fine :)

This was the bug which has not been addressed in the dev version as of now: https://www.drupal.org/node/2283245

Thanks.

Amit Sedai
Amit Sedai
June 25, 2014 09:55 AM

I fixed this bug by downgrade field group module from 7.x-1.4 to 7.x-1.3

step by step

  1. disable field group module.
  2. delete field group module folder from server.
  3. install module from http://ftp.drupal.org/files/projects/field_group-7.x-1.3.tar.gz
  4. enable module again.
  5. run update.php

It's works for me.

arthitst
arthitst
June 27, 2014 16:12 PM

Or you can define ids for your groups :

enter image description here

It will fix the message as the JS error.

Kgaut
Kgaut
November 25, 2014 15:17 PM

Related Questions


Use drupal.settings variables on javascript

Updated March 27, 2015 14:18 PM

Passing Javascript variable in my module file

Updated July 27, 2015 14:03 PM

Calling a contact form in a certain page

Updated August 23, 2015 17:03 PM