I have 3 different fields assigned to 3 different select list options.

field 1 is dependent on option 1
field 2 is dependent on option 2
field 3 is dependent on option 3

There are 6 options in the select list.

When the form loads, none of the dependent fields are hidden.
When I select option 1 for the 1st dependent field that was added, both field 1 and the select list itself disappear.
When I select the 2nd or 3rd options, field 1 disappears.
When I select an option without a dependent field, both field 1 and the select list itself disappear.

No errors appear in the javascript console.

Comments

Gidgidonihah’s picture

This is why I dislike not being able to edit the first post.

The obvious spelling error should in fact be 'disappears'.

Tamar Badichi-Levy’s picture

I will try to see if I get the same behavior in my test site.
Can you please upload your CCK export text?
BTW, what version of jquery are you using? I'm using the 1.2.1 vesrion from the 'jquery_update' module.

Gidgidonihah’s picture

I modified the content design to due this and went live, so I can't export. I'll try to recreate on the test site.

As for which version of jquery, I'm not sure, but it is quite old.

I'll see if I can recreate, update jquery, and get back here with my results.

Thanks.

Gidgidonihah’s picture

Ok, I recreated everything and confirmed the error was still there.
Another odd thing I noticed which occured before i played with weights (though I don't know why that would affect it)
Was that at one point it hid the title field.

Continuing on, I installed the jquery_update module.
Errors persisted.

Then after I realized I left out a pretty significant factor in the bug report, I figured I better test that out.
Recreated the same as stated in the first post using a select list and 3 text fields.
Everything worked perfectly.

The problem is, that I was trying to hide date fields. Everything works as should with text fields, but the problem occurs when the fields to be hidden are date fields.

And it took me a minute to figure out since I didn't have the content copy module enabled, but here's the export text:

$content[type]  = array (
  'name' => 'test',
  'type' => 'test',
  'description' => '',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
  ),
  'print_display' => 1,
  'show_preview_changes' => 1,
  'old_type' => 'test',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'xmlsitemap_node_type_priority' => '0.5',
  'xmlsitemap_old_priority' => '0.5',
  'ant' => '0',
  'ant_pattern' => '',
  'ant_php' => 0,
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'options_select',
    'label' => 'duh',
    'weight' => '-4',
    'description' => '',
    'default_value_widget' => 
    array (
      'field_duh' => 
      array (
        'key' => '',
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => 'o
m
g
w
t
f',
    'allowed_values_php' => '',
    'field_name' => 'field_duh',
    'field_type' => 'text',
    'module' => 'text, optionwidgets',
    'default_value' => 
    array (
      0 => 
      array (
        'value' => '',
      ),
    ),
  ),
  1 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'd1',
    'weight' => '-3',
    'default_value' => 'blank',
    'default_value_code' => '',
    'default_value2' => 'same',
    'default_value_code2' => '',
    'input_format' => 'Y-m-d H:i:s',
    'input_format_custom' => '',
    'year_range' => '-3:+3',
    'increment' => '1',
    'advanced' => 
    array (
      'label_position' => 'above',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'description' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'repeat' => 0,
    'todate' => '',
    'granularity' => 
    array (
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'output_format_date' => 'm/d/Y - H:i',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, F j, Y - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, m/d/Y - H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'm/d/Y - H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_name' => 'field_d1',
    'field_type' => 'date',
    'module' => 'date',
    'dependent_options' => 
    array (
      0 => 1,
    ),
    'put_after_parent' => '1',
  ),
  2 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'd2',
    'weight' => '-2',
    'default_value' => 'blank',
    'default_value_code' => '',
    'default_value2' => 'same',
    'default_value_code2' => '',
    'input_format' => 'Y-m-d H:i:s',
    'input_format_custom' => '',
    'year_range' => '-3:+3',
    'increment' => '1',
    'advanced' => 
    array (
      'label_position' => 'above',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'description' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'repeat' => 0,
    'todate' => '',
    'granularity' => 
    array (
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'output_format_date' => 'm/d/Y - H:i',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, F j, Y - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, m/d/Y - H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'm/d/Y - H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_name' => 'field_d2',
    'field_type' => 'date',
    'module' => 'date',
    'dependent_options' => 
    array (
      0 => 2,
    ),
    'put_after_parent' => '1',
  ),
  3 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'd3',
    'weight' => '-1',
    'default_value' => 'blank',
    'default_value_code' => '',
    'default_value2' => 'same',
    'default_value_code2' => '',
    'input_format' => 'Y-m-d H:i:s',
    'input_format_custom' => '',
    'year_range' => '-3:+3',
    'increment' => '1',
    'advanced' => 
    array (
      'label_position' => 'above',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'description' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'repeat' => 0,
    'todate' => '',
    'granularity' => 
    array (
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'output_format_date' => 'm/d/Y - H:i',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, F j, Y - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, m/d/Y - H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'm/d/Y - H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_name' => 'field_d3',
    'field_type' => 'date',
    'module' => 'date',
    'dependent_options' => 
    array (
      0 => 3,
    ),
    'put_after_parent' => '1',
  ),
);
Tamar Badichi-Levy’s picture

I imported you cck type but I still cannot reproduce this bug. What versions of this module and "Date" module are you using? What other cck modules are you using?

Gidgidonihah’s picture

Oh, right I neglected to mention that I'm using Date 5.x-2.x-dev
(gasp! dev in a production enviornment?! I know, but it has the features that were mission critical.)

Other CCK modules enabled are:

Address Field 5.x-2.1
Computed Field 5.x-1.2
Content Taxonomy 5.x-1.x-dev
Content Taxonomy Autocomplete 5.x-1.x-dev
Content Taxonomy Options 5.x-1.x-dev
Dependent 5.x-1.4-beta
EMail 5.x-1.x-dev
Fieldgroup 5.x-1.7
ImageField 5.x-2.1
Link 5.x-2.3
Money 5.x-1.5
Node Reference 5.x-1.7
Number 5.x-1.7
Option Widgets 5.x-1.7
Text 5.x-1.7
Textfield Autocomplete 5.x-1.x-dev

Tamar Badichi-Levy’s picture

Are you using php5 and higher? My code is not compatible with php4 as far as I know.

Gidgidonihah’s picture

Isn't it more likely that the issue would be in the javascript and not the PHP since that's actually what's hiding the fields?

I was running 5.1 and just upgraded to 5.2. Haven't tried it since the upgrade.

Tamar Badichi-Levy’s picture

Cab I mark this issue as fixed?

Gidgidonihah’s picture

I would say no. It's a bug that hasn't been fixed. Granted I decided against deploying like this, but that was because of this bug. I'd still love to help you fix it.

I imported the content type I listed above into a test environment. Like I said, it's not a php problem. We've upgraded to php5 and everything is exactly the same.

It looks like the problem lies with the JS and Date-5.x-2.x elements.
I set it up with text boxes and address elements (cck address) and it works like it should.
It's the date, however, that causes a problem:

There are no JS errors unless a date element is dependent. When added 1 dependent date element I got the following JS error on page load:

Error: [Exception... "Node cannot be inserted at the specified point in the hierarchy"  code: "3" nsresult: "0x80530003 (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)"  location: "http://my.site/testsite/misc/jquery.js Line: 2"]
Source File: http://my.site/testsite/misc/jquery.js
Line: 2

On page load, all dependent items are visible. Lets say I have options A, B and C. I have a text box dependent on A, address dependent on B and the date dependent on C. If I select A, the text box and address disappear as does the select box itself. If I select B, the same thing happens. If I select C, the text box and address disappear but the select box does not. The date never disappears.

Then I deleted Date 5.x-2.x and tried the same thing with Date 5.x-1.x. Everything works beautifully.
Looks like the issue is when we're working with Date 5.x-2.x.

Now I don't know if this is something in your code that needs to be fixed, or the date code. Where should we go from here, maybe you get with KarenS about it?

Tamar Badichi-Levy’s picture

Sorry for not being around. I was on vacation in Namibia. A great landscape. However, It is really interesting, I use date fields and it works like a charm. Can you give me a link to this page? I would like to debug the javascript code.