Not working with fieldgroups?

patchak - May 17, 2008 - 21:18
Project:Conditional Fields
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

Hey there, I'm using latest version of this module and I can see that it does not work with fieldgroups. I tried setting up a controlling field and some controlled fields all in the same group. When the group is displayed all the fields are open.

Is there anything special to do to have this module work with fieldgroups??

Patchak

#1

peterpoe - May 19, 2008 - 11:17
Component:Javascript» Code

I confirm this bug. This problem is caused by erroneous creation of enclosing divs, which makes the javascript unable to work correctly. Changing it to code bug.

#2

patchak - May 19, 2008 - 12:44

Hey there Peterpoe, do you have the intention of looking into this issue? have you got my mail about this issue and the other issues of the module??
Alexis

#3

threexk - May 23, 2008 - 15:05

Note that this problem does not occur with the March 22 dev.

#4

peterpoe - May 23, 2008 - 16:20
Status:active» patch (code needs review)

In cvs there are new versions of conditional_fields.module and .js which should solve the problem. Please test!

These were actually two bugs:
- One in javascript introduced by this #254996: Help text visibility not toggled change, which included handling for multiple fields. The problem is that both fieldgroups and multiple fields use fieldsets. The only difference between the two fieldsets is that fieldgroup fieldsets have an id like "group-groupname". So the script has to check this too.
- The other in code, pertaining the themeing of fields inside fieldgroups (themeing was applied to the fieldset, instead of the fields inside it). It was introduced by this other change #227416: hook_form_alter().

Sorry all, I just don't have the time to follow this module as much as it deserves this right now!

#5

threexk - May 23, 2008 - 18:43

In CVS, the latest files I see are four months old. Am I missing something?

Thanks a lot for your work on this module.

#6

peterpoe - May 23, 2008 - 18:46

I didn't mention: check the DRUPAL-5 tag.

#7

threexk - May 23, 2008 - 19:23

Sorry, I am new to Drupal CVS and thought the latest module code was always in the HEAD branch.

Conditional fields within a field group still do not work. The controlled field shows up even though its controlling value is not selected. I tried re-creating all the fields from scratch, but no luck.

Here is an export of my test case content type (maybe it will be helpful):

$content[type]  = array (
  'name' => 'Test Conditional Fields 259705',
  'type' => 'test_conditional_fields_259705',
  'description' => '',
  'title_label' => 'Title',
  'body_label' => '',
  'min_word_count' => '0',
  'help' => '',
  'node_options' =>
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
  ),
  'nodefamily_max' => '0',
  'nodeprofile' => 0,
  'old_type' => 'test_conditional_fields_259705',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'ant' => '0',
  'ant_pattern' => '',
  'ant_php' => 0,
);
$content[groups]  = array (
  0 =>
  array (
    'label' => 'test_group',
    'settings' =>
    array (
      'form' =>
      array (
        'style' => 'fieldset',
        'description' => '',
      ),
      'display' =>
      array (
        'description' => '',
        'teaser' => NULL,
        'full' => NULL,
        'label' => NULL,
      ),
    ),
    'weight' => '0',
    'group_name' => 'group_test_group',
  ),
);
$content[fields]  = array (
  0 =>
  array (
    'widget_type' => 'text',
    'label' => 'controlled',
    'weight' => '0',
    'rows' => '1',
    'description' => '',
    'default_value_widget' =>
    array (
      'field_controlled' =>
      array (
        0 =>
        array (
          'value' => '',
        ),
      ),
    ),
    'default_value_php' => '',
    'group' => 'group_test_group',
    'conditional_fields' =>
    array (
      'field_controller' => 'conditional_field_no_value',
    ),
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '0',
    'size' => '',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_controlled',
    'field_type' => 'text',
    'module' => 'text',
    'default_value' =>
    array (
      0 =>
      array (
        'value' => '',
      ),
    ),
  ),
  1 =>
  array (
    'widget_type' => 'options_buttons',
    'label' => 'controller',
    'weight' => '0',
    'description' => '',
    'default_value_widget' =>
    array (
      'field_controller' =>
      array (
        'key' => '',
      ),
    ),
    'default_value_php' => '',
    'group' => 'group_test_group',
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '0',
    'size' => '',
    'max_length' => '',
    'allowed_values' => 'hide controlled field
show controlled field',
    'allowed_values_php' => '',
    'field_name' => 'field_controller',
    'field_type' => 'text',
    'module' => 'text, optionwidgets',
  ),
);

#8

peterpoe - May 23, 2008 - 20:44

Now this is odd. I imported your content type definitions, and it works. Which version of Drupal / modules installed are you using?

#9

threexk - May 23, 2008 - 20:55

D'oh I had another directory old_conditional_fields in the modules directory, and it was executing instead of the new conditional_fields from CVS.

It works now, both with the test case and my original form.

#10

peterpoe - May 28, 2008 - 10:30
Status:patch (code needs review)» closed

Marking as closed...

 
 

Drupal is a registered trademark of Dries Buytaert.