Active
Project:
Comment CCK
Version:
6.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jun 2009 at 22:56 UTC
Updated:
6 Nov 2009 at 20:42 UTC
When I update a Date field via comment cck, the field value is deleted instead of being updates to the new value.
Comments
Comment #1
nashINATOR commentedBump!
I have the same problem. I wonder what other content types it deletes?
Nash
Comment #2
a_c_m commentedthis might be related to http://drupal.org/node/527258 please test.
Comment #3
nashINATOR commentedComment #4
nashINATOR commentedThe patch had no effect on the problem. The following was the error generated when a date was either modified or left unmodified. Please also note that the date field was submitted with a null value, which is why this error occurred:
* warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /var/www-track-dev.tools/public_html/sites/all/modules/date/date/date_elements.inc on line 550.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www-track-dev.tools/public_html/sites/all/modules/date/date/date.theme on line 224.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www-track-dev.tools/public_html/sites/all/modules/date/date/date.theme on line 225.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www-track-dev.tools/public_html/sites/all/modules/date/date_api.module on line 733.
Your thoughts?
Nash
Comment #5
Russell commentedAfter much playing around I figured this out. Basically when Comment_CCK data gets passed to all the various widget validation routines etc, each fields data exists in $form_state['comments_cck'][FIELDNAME]. The date_combo_validation route expects it to be in $form_state[FIELDNAME] and due to it not being there, the initial value of a flag never gets changed so it ends up replacing the $element['#value'] values with empty values.... if you didn't understand that don't worry, it made my head hurt too.
I hard coded a hack for this, unfortunately I'm new to Drupal and don't know enough about the data structures to fix it properly.
Find your copy of date/date/date_elements.inc and find function date_combo_validate (line 384 for me) and at the top of the function change
$form_values = $form_state['values'];
to
$form_values = $form_state['values'];
if ($element['#parents'][0] == "comment_cck")
$form_values = $form_state['values']['comment_cck'];
Repeat the changes in date_widget_validate (line 550 for me).
I'm thinking that you could probably check all values of $element['#parents'] starting at 0 (ending just before you get to the FIELDNAME entry) and use those to navigate the $form_state array, but I'm not too sure.
Comment #6
nashINATOR commentedLOL! Russell you are a genius! (He's only been playing around with drupal for about less than a day or so and came up with this hack!) ("...it made my head hurt too." - Yea right!)
Comment #7
tevih commentedsubscribe... i didn't get that and now my head hurts, too