Hi, i create a new installation on my local server, on this i set a new content type (test) and add to this a new date field (selection), after that i go to create a new content (?q=node/add/test) and create node, but date are not saved into DB, if i go on table content_type_test i find a column called field_data_value but is empty.

Anyone can help me to solve the problem? I find into issues but don't find similar problem.

This is settings on my server, and module are only default + cck + date (vesion specified)

Drupal	5.10
GD library	bundled (2.0.34 compatible)
MySQL database	5.0.51
PHP	5.2.5
PHP register globals	Disabled
Unicode library	PHP Mbstring Extension
Web server	Apache/2.2.6 (Win32) mod_autoindex_color PHP/5.2.5

CCK	5.x-1.7
Date	5.x-2.0-rc6
DateAPI	5.x-2.0-rc6
Date Timezone	5.x-2.0-rc6

Comments

michaek’s picture

When I roll back to date rc5, this issue is resolved. You might give that a try.

mavimo’s picture

I'm go back to 1.8 with some patch obtained from 2.0-rc6, for example to set date-time range into drop-down date (on 1.8 i cannot set -X:-Y, but only -X:+Y).

This is just a bug report hto help dev to solve problem :D

KarenS’s picture

Status: Active » Postponed (maintainer needs more info)

@mavimo - I don't know why you're talking about "1.8", that's a different version that works completely differently. I don't see any reference anywhere in this issue to not being able to set a year range and can't see how that would be related.

As for the original issue, I can't replicate this, I can create dates just fine, so there must be something specific in the kind of date you're trying to create. I need an export of your date field (use the Content Copy module to create this).

michaek’s picture

when i updated to rc6 from rc5, it appeared to stop saving dates. doesn't seem i'm the only person having this problem. i will look into this more over the weekend and determine whether its a config problem or a conflict with another module.

LinL’s picture

Further to #294964: Date field as Select List no longer saves) I'm moving it over to this issue.

Here are exports of my date field, first with a widget type of text and secondly with a widget type of select.

When the field is text it is saved and when it is a select box it is not.

Please let me know if you need any more info.

(Drupal 5.10, PHP 5.2.4, MySQL 5.0.51a)

$content[type]  = array (
  'name' => 'Test Date',
  'type' => 'testdate',
  'description' => 'Test Date rc6',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
    'premium' => false,
  ),
  'comment' => '2',
  'amazon_related_link' => '0',
  'show_preview_changes' => 0,
  'old_type' => 'testdate',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'ant' => '0',
  'ant_pattern' => '',
  'ant_php' => 0,
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_text',
    'label' => 'Test Year',
    'weight' => '0',
    'default_value' => 'blank',
    'default_value_code' => '',
    'default_value2' => 'same',
    'default_value_code2' => '',
    'input_format' => 'M j Y - H:i:s',
    'input_format_custom' => '',
    'advanced' => 
    array (
      'label_position' => 'above',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'increment' => '1',
    'year_range' => '-208:+0',
    'description' => '',
    'required' => '0',
    'multiple' => '0',
    'repeat' => 0,
    'todate' => '',
    'granularity' => 
    array (
      'year' => 'year',
    ),
    'output_format_date' => 'd/m/Y - H:i',
    'output_format_custom' => 'Y',
    'output_format_date_long' => 'l, F j, Y - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'F j, Y - H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_name' => 'field_test_year',
    'field_type' => 'date',
    'module' => 'date',
    'label_position' => 'above',
    'text_parts' => 
    array (
    ),
  ),
);
$content[type]  = array (
  'name' => 'Test Date',
  'type' => 'testdate',
  'description' => 'Test Date rc6',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
    'premium' => false,
  ),
  'comment' => '2',
  'amazon_related_link' => '0',
  'show_preview_changes' => 0,
  'old_type' => 'testdate',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'ant' => '0',
  'ant_pattern' => '',
  'ant_php' => 0,
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'Test Year',
    'weight' => '0',
    'default_value' => 'blank',
    'default_value_code' => '',
    'default_value2' => 'same',
    'default_value_code2' => '',
    'input_format' => 'M j Y - H:i:s',
    'input_format_custom' => '',
    'year_range' => '-208:+0',
    'increment' => '1',
    'advanced' => 
    array (
      'label_position' => 'above',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'description' => '',
    'required' => '0',
    'multiple' => '0',
    'repeat' => 0,
    'todate' => '',
    'granularity' => 
    array (
      'year' => 'year',
    ),
    'output_format_date' => 'd/m/Y - H:i',
    'output_format_custom' => 'Y',
    'output_format_date_long' => 'l, F j, Y - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'F j, Y - H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_name' => 'field_test_year',
    'field_type' => 'date',
    'module' => 'date',
    'label_position' => 'above',
    'text_parts' => 
    array (
    ),
  ),
);

LinL’s picture

I have had a look at this and I think I have figured out where the problem lies. (Though I am quite new to Drupal, so could easily have missed something critical!)

Looking at version 5.x.2.0-rc6.
In the function date_select_validate in date_api_elements.inc the variable $value is set at the start (line 386) and at that point contains the correct data, but by the time it is referenced at line 426 it is empty.
I haven't figured out why or how it is empty, but in my use case it is.

I added this line after line 425:

$value = date_select_input_value($element);

and in context:

if (!form_get_errors()) {
    // If it creates a valid date, set it.
    $value = date_select_input_value($element); 
    if (!empty($value)) {
      form_set_value($element, $value);
    }

and all appears to work OK.

Sorry, I haven't yet figured out how to make a proper patch file to attach with a diff against cvs, this is the closest I got:

diff date/date_api_elements.inc mydate/date_api_elements.inc
425a426
>     $value = date_select_input_value($element); 
LinL’s picture

Status: Postponed (maintainer needs more info) » Needs review

Changing status for #6.

tille’s picture

thank you very much - adding one line of code is really not such a pain.. I almost de-installed various modules - good that it's 'only' a fixable bug..:]

greetz, t..

KarenS’s picture

Status: Needs review » Closed (duplicate)

I think this is coming from the same problem as #292617: Date Repeat errors when Date Popup module is turned off and that fixing that problem will fix this one, too. It is not the regular select widget that is creating this problem, it's the one in the repeat form.

Marking duplicate because that's where we'll track the fix.