Hi,

I'm creating nodes using services through XMLRPC. All works fine, but I cannot modify the data (field_date) that the node must use. The structure I'm using correct, however when I see the new node I obtain:

    [field_date] => Array
        (
            [0] => Array
                (
                    [value] => 
                    [value2] => 
                    [timezone] => Europe/Madrid
                    [timezone_db] => UTC
                    [date_type] => datetime
                )

        )

Although I'm passing the date in the creation, instead of

    [field_date] => Array
        (
            [0] => Array
                (
                    [value] => 2011-05-20 10:49:17
                    [value2] => 2011-05-20 11:49:20
                    [timezone] => Europe/Madrid
                    [timezone_db] => UTC
                    [date_type] => datetime
                )

        )

That is the structure I receive when I look the node with .get once I add a date with node/edit.

Any clue?.

Thanks!

Comments

marcingy’s picture

Priority: Major » Normal

Suport requests can not be major.

marcingy’s picture

You need to look at what drupal excute excepts and specifically what structure the date field is excepting. The format depends on the widget and lots of strange things happen in date module. Sorry I can't help anymore other than suggesting submit a form in drupal itself add a dpm and see what the data structure should look like.

un11imig’s picture

Status: Active » Closed (fixed)

Finally I find the error is not a services issue, but a date issue.

I close the issue.

gianfrasoft’s picture

un11imig, please explain...!

un11imig’s picture

Hi gianfrasoft

I add the next code on date module (date_elements.inc,v 1.46.2.2.2.70 2010/12/29 14:11:50):

    (..)

    if (!empty($field['todate'])) {
      $to_date = date_input_value($field, $element[$to_field]);
    }
    else {
      $to_date = $from_date;
    }

    //added
    if (empty($from_date)&&!empty($element['#post']['field_date']['0']['value']))
    {
      //In that case we are in a popup configuration and we are recovering the information from XMLRPC.
      $from_date = $element['#post']['field_date']['0']['value'];
      $to_date = $element['#post']['field_date']['0']['value2'];
    }
    //End added.
     
    
    // Neither the from date nor the to date should be empty at this point
    // unless they held values that couldn't be evaluated.
    if (!$field['required'] && (empty($from_date) || empty($to_date))) {
      $item = date_element_empty($element, $form_state);
      $errors[] = t('The dates are invalid.');
    }
    (..)

In our case we are working with the POPUP witched.

Regards,

hubobbb’s picture

Version: 6.x-2.4 » 8.x-4.x-dev
Issue summary: View changes

drupal7 Services Module 3.17
REST SERVER, Using with Pop-up Calendar widget and Date fields

server side :set field Pop-up calendar ,work well .
client ajax :

"node[field_mytime][und][0][value][date]="+"2017\-01\-01"+"&node[field_mytime][und][0][value][time]="+"11\:45"
+"&node[field_mytime][und][0][value2][date]="+"2018\-01\-01"+"&node[field_mytime][und][0][value2][time]="+"12\:45";