c.f. node #1036444

An error is a little hard or not? But maybe we can add a status message above the calendar??
"No date fields are selected"

[Edit: D'oh! I didn't notice that I had to first add the field to the view, then select the field from the select area. Just a matter of documentation, really. We should maybe put a little notice at the top of the Field Settings pane in the View that says "Fields must be added to the view before they are available to select here." (something like that).

I get stuck by the "no date field" error, even though I have one (I tried with date, datetime and datestamp field types) ! Moreover, I have an empty list when I try to " Use a custom date field" in "Row style : Fields - Fullcalendar". What do I do wrong ?
Maybe if you could update the README file of the 7.x 2.x version ...

I need to do a presentation this afternoon, and nothing is displayed in my calendar since I am considered not to have correctly configured my view ! Will I have to downgrade the plugin or is this just a config issue or a forgotten step ?

Whatever, thanks in advance and for all the wonderful work you are doing here !

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aspilicious’s picture

1) Create a custom content type with a date/datetime field in it
2) Select fields in the views UI (there is a fields section, click on the add sign and choos the date field you would like to display)
==> http://awesomescreenshot.com/0186qmf3b

3) Change row style if needed (ONLY IF NEEDED)
http://awesomescreenshot.com/09e6qmwdc

FrequenceBanane’s picture

I had already done steps 1 and 2 when I created this topic ... And even if I would to step 3, nothing appears when I check "use custom dte field" (after having done steps 1 and 2, of course).

Any idea ?

aspilicious’s picture

o_O...

If you use the x.1 versions can you see your events? (that version doesn't need the field configuring step)

FrequenceBanane’s picture

Yes I do, so I downgraded until we find what goes wrong ...

aspilicious’s picture

Hmmm do you use irc? You can find me in #drupal and #drupal-contribute. Try latest dev versions of fullcalendar, views 3, ctools and date...

It's hard to find the issue if I can't reproduce it...

aspilicious’s picture

The only thing I can think of is that you added "a date field" but that you didn't add "the date fields" corresponding to your events.

FrequenceBanane’s picture

I already have the latest dev versions of views3, ctools, and date (and fullcalendar of course). See you on #drupal on #drupal-contribute, so.
I also have the following error message on every page displaying my calendar, as many time as I have previously created content :
Notice: Undefined property: stdClass::$_field_data dans template_preprocess_views_view_node_fullcalendar() (ligne 244 dans /var/www/fb2011/sites/all/modules/fullcalendar/fullcalendar.module)..
I assume any date field can be found for these events (which therefore do not appear in my calendar).

Here is a (big) picture so you can verify I add the right date field of the right content type.

FrequenceBanane’s picture

Status: Active » Closed (fixed)

Deleting and recreating the fullcalendar view may solve the problem before than trying to debug ...
It works fine, now.

amitaibu’s picture

Category: task » bug
Status: Closed (fixed) » Active

This seems to be a bug in 7.x-2.x version.

In fullcalendar_plugin_display_page::validate() we have

$field_options = $this->display->handler->get_field_labels();
$date_fields = fullcalendar_date_fields($field_options);

The problem is that $field_options has the label name instead of the field name.

amitaibu’s picture

Status: Active » Needs review
FileSize
718 bytes

And the patch...

amitaibu’s picture

FileSize
784 bytes

patch that prevents notice.

aspilicious’s picture

Status: Needs review » Fixed

Nop thats correct. The notices are caused by something else.
If there are no results from the views query. Will be fixed in an other issue.
If you build your view correct there are no warnings.
I helped FrequenceBanane debugging.

Status: Fixed » Closed (fixed)

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

skari’s picture

It seems that this issue has resurfaced, assuming it was fixed.
I just installed Fullcalendar using the latest of Ctools, Date and Views, (and I have also tried the latest dev releases) and I have tried both the beta-3 and the latest dev release of fullcalendar. I am getting this same error. It appears that the date fields I am selecting don't get past the fullcalendar_field_is_date check. I am trying this out with the standard date fields like node posted etc.

In particular the date fields I have selected fail the "isset($field->field_info)" criteria (line 325 in fullcalendar.module). What is this field_jnfo stuff? I tried to skip this from the test, but that resulted in some very nasty error messages.

I'll keep investigating this, but if someone knows the answer it would be nice to have it.

Thanks

skari’s picture

Hmm... ok the module is making (undocumented?) assumptions about the kinds of date/timestamp fields that are displayed. Well #1.1 mentions that one has to create a custom content type with a date/datetime field in it. But is should also mention that this must be done via the Field API.

I was trying this out using a content type I am defining via hook_schema in .install and hook_views_data, so I thought I was ok (i.e. using a custom content type). I am doing this as I find the Field API too cumbersome in some situations.

But the short story is: standard time/date database fields like created, update and other fields defined via hook_schema and/or hook_views_data won't work with FullCalendar as it stands. I think the value of this module would be greatly enhanced if this would be fixed.

Thanks

SunRhythms’s picture

I get the error too... Interesting enough my view shows my entered dates in preview but I couldn't get the error messages off the top. I even added extra date fields. But ............ then I deleted all of the extra fields, turned off the drag and drop feature, and checked my page menu settings to make sure it would show in the main menu and the error messages disappeared. Perhaps its the drag and drop feature.

diraol’s picture

Hi friends, i'm still getting this error. I can't create a view "page" with fullCalendar, it doesn't recognize the date field i've chosen.

And i can't apply the patch recomended by Amitaibu on #11 because the file referenced there ("fullcalendar_plugin_display_page.inc") doesn't exist on the module folder.

salvis’s picture

I had this same problem, too. I think the trick is to save the view after you've added the field.

Richard Dyck’s picture

Status: Closed (fixed) » Active

I have the same issue as the initial poster. I have a date field but adding it doesn't get rid of the error message.

biohabit’s picture

I'm seeing the same issue, or at least seeing it when I'm trying to figure out why the local, event content type stops displaying but the google calendar feeds display just fine at TheDirt.org/cal

I'm seeing the same error message when I create a new FullCalendar view from scratch and it won't display the existing content type and just displays the error message about not date field not being set.

KeepXtreme’s picture

@Richard: did you configure an end date to the Date field? If yes, try this: For me the error disappeared after I selected "only startdate"

apmsooner’s picture

My trick was to make sure the date field was also added to the master display. Once i did that... errors gone.

theMusician’s picture

This seemed to only effect us when using recurring dates. As apmsooner in #22 indicated adding the date field to the master display seems to have cured the view.

dnotes’s picture

I know this is old, but I also got stuck with this problem and I do NOT want the date field in the master display. I think that the patch below should fix this problem.

To test it, you'll need to create a view that does not have the date field in the master view, then create a new display and add the date field to the display only. Then try to make it a fullcalendar. Without this patch, I think you won't see any options when you try to specify the date fields in the fullcalendar style settings; with the patch, it should work. You may need to save and/or clear the cache if you were editing a view.

I'm not certain whether this implementation could cause other problems, or if the above patches in #10 or #11 may be a better approach; I'm just not familiar enough with views to properly evaluate them. What I do know is that this patch fixes a problem where the fullcalendar style plugin tries to access fields directly on the $view object at a time when only the master display's fields are loaded, and that's why one has had to add a date field to the master display in order for everything to work.

dnotes’s picture

Status: Active » Needs review
sivani45’s picture

Iam using 7.x-2.0 full calendar version drupal7 and civicrm 4.5.4 .I want civicrm events in full calendar but when iam adding event it is showing Display "Page" requires at least one date field error.Thats why used 7.x-2.x-dev version of full calendar it is also same error is showing plz tell proper patch..???

DuaelFr’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

#24 works as is the right way to fix this issue!
There is no reason to rely on master display here.

Thanks @dnotes for your patch, I'm sad that I fixed the code (exactly the way you did) before finding this issue ;)

jrb’s picture

Version: 7.x-2.x-dev » 8.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
FileSize
629 bytes

This is an issue in Drupal 8, too. Here's a D8 version of the patch in #24.

jrb’s picture

Version: 8.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Reviewed & tested by the community

Setting status and version back.

barami’s picture

Accessing field handler directly from array can causes errors for display when default display is not fullcalendar display.
When called $view->preview, it calls $view->validate function and fullcalendar_plugin_style_fullcalendar::validate function doing weired actions.

function validate() {
  if ($this->display->display_plugin != 'default') {
    // Get the date fields.
    $date_fields = $this->fullcalendar_parse_fields();
    if (empty($date_fields)) {
      drupal_set_message(t('Display "@display" requires at least one date field.', array('@display' => $this->display->display_title)), 'error');
    }
  }

  return parent::validate();
}

if ($this->display->display_plugin != 'default')
This condition failed to exclude default display and calls fullcalendar_parse_fields method for default display.
If default display does not have date field, fullcalendar_parse_fields method return empty and error message will be print.


function fullcalendar_parse_fields($include_gcal = TRUE) {
  // Ensure the handlers are there.
  $this->view->init_handlers();

  $labels = $this->display->handler->get_field_labels();
  $date_fields = array();
  foreach ($this->view->field as $id => $field) {
    if (fullcalendar_field_is_date($field, $include_gcal)) {
      $date_fields[$id] = $labels[$id];
    }
  }
  return $date_fields;
}

$this->view->init_handlers();
init_handlers modify the handlers data structure and somteimes it generates weired data to $this->view->field property when view has multiple display. (This line calls init_handlers per views display and modify same data ($this->view->field) when called per view display. So, this process can produce an unexpected data array.)
See #2212175: Overridden field settings ignored with multiple Views displays and different style plugins and #2212195: Error notices with multiple Views displays with different amounts of fields

init_handlers method is unnessary to call in this phase.
We could use methods of views display to get field and style handlers.

barami’s picture

Status: Reviewed & tested by the community » Needs review