I cant get the event dates to save at all unless I add this to a _submit() function;

  foreach ($form_state['values']['field_event_date']['und'] as $k => $vals) {
    $form_state['values']['field_event_date']['und'][$k] = $vals[0];
  }

It seems strange that I am the only one who is experiencing this (judging by the issues) and curious about if this is a known issue with a simple fix?

The 'fix' (removing the additional array key) above might also be why, in the views, none of the repeats show up (they dont appear on the 'repeats' tab either.

Any help would be seriously appreciated.

Thanks,

Christian

Comments

cb’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta4

This is still happening in the latest version. I'm surprised that nobody else seems to be having this problem.

I'll leave my fix in place for the moment then. Would love any info about this if there is any.

lcsi’s picture

I have the same problem. Where did you add the submit function?

cb’s picture

This was purely for testing - I dont see this as a 'fix' but more a 'hack' - so use at your own risk.

I created a module and a hook_form_alter ...

/**
 * Implements hook_form_alter().
 */
function my_module_form_alter(&$form, &$form_state, $form_id) {
 if ($form_id == 'event_node_form') {
   $form['#validate'][] = 'my_module_form_validate';
 }
}

And then added the validate function which moves the data around so it can be saved ...

function my_module_form_validate(&$form, &$form_state) {
  foreach ($form_state['values']['field_event_date']['und'] as $k => $vals) {
    $form_state['values']['field_event_date']['und'][$k] = $vals[0];
  }
}

Hope that helps. I am going to be digging into the module a bit soon to seee if i can find the cause.

nedjo’s picture

Thanks for the notes and workaround. I haven't been able to reproduce this bug. Can you give exact steps?

cb’s picture

Hi nedjo,

Simply creating an event and adding a date will cause the problem. Whether you add repeats or not, nothing relating to the date will save. All other content saves fine.

Basically, it seems the problem is caused by an extra key in the array, which is what my hack fixes.

Thanks

rosemarymann’s picture

Have you ensured you are using the dev version of views, ctools, date and calendar? Only this combination will work.

cb’s picture

I'm not sure how I missed those requirements. Seems to be working perfectly now, thanks so much!

nedjo’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.