I'm not sure if it's limited to my setup but so far neither dev for the beta work. Whenever I click "add a new date range" with or without JS enabled I get the same thing. Nothing. The ajax request returns empty to errors and the non js version just reloads the same page. I am going to look more into this module on Sunday but if anyone has had this issue and knows the solution that'd be great.

Also does this module have the ability to do custom date ranges and is there a reason beyond it not being needed? Because that is something I would like to put in.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Daemon_Byte’s picture

think this might be a facetapi error. https://drupal.org/node/2122119

eugene.ilyin’s picture

It's actually? Seems #2122119 is solved.

Daemon_Byte’s picture

Status: Active » Closed (fixed)

yes it was an error in facetapi and that was fixed.

codium’s picture

Still not work for me. I've tried to apply patch from #1 but already in code...

eugene.ilyin’s picture

@codium, can you provide more info please? Versions, conditions, symptoms?

codium’s picture

@eugene.ilyin

More details:

Date Facets: 7.x-1.0
Facet API: 7.x-1.5
Ctools: 7.x-1.9
Search API: 7.x-1.16

What I've done:

Add: date field (single value - birthday) to index.
Enable Date Facets
Select Date Range with checkboxes as widget type
Configure two date ranges
Set Operator to 'OR'
In Sort options select only 'Display value'
Export current settings via Features

Then I've tried to add another date range, but click action on button 'Add a new date range' causing only page reload

I removed date field from index, and repeated above steps. Old date ranges are shown with no possibility to add new one.

codium’s picture

@eugene.ilyin any updates?

djdevin’s picture

I can't configure the date ranges either. Running dev versions of everything. Will try to investigate.

codium’s picture

@eugene.ilyin

I've read code. IMO add new date range cannot work.

I've created a patch. Seems to work, but new date range is not saved. Can you review and improve it?

codium’s picture

Status: Closed (fixed) » Needs review
f0ns’s picture

I have the same issue, I'll try to debug this asap and let you know when I found a solution. If anyone else has a quick fix for this issue i'll be glad to test it.

UPDATE: couldn't get this to work, i'll have to investigate this further.

f0ns’s picture

I think I found the issue, atleast it got me to add some more options:

in file lib/DateRangeWidget.php I've put $form_state['add_new_range'] = FALSE; in comment on line 218:

if (isset($form_state['add_new_range']) && $form_state['add_new_range']) {
      //$form_state['add_new_range'] = FALSE;
      ...
florisg’s picture

Confirmed patch #12 works, re-rolled against git. with fuzz 1 (newline EOF)

florisg’s picture

it does allow UX to but does not seem to store or show after Clear Cache (Using Facetapi 1.x-dev)
needs refactoring

pixelpreview@gmail.com’s picture

I confirm, I have the same result, I use the patch I create new date fields and after save, all of my new date fields disappeared on the edit page.

I can't change the already configured date fields by the module. When I change the settings, nothing saved.

MickL’s picture

Title: not allowing me to add new facets » Not allowing me to add a new date range
Priority: Normal » Major
Status: Needs review » Active

I can confirm that it is not possible to add a new date range. That is kind of critical, because after deleting all date ranges, it wouldnt be possible to have any date range and the module doenst work anymore.

judapriest’s picture

If you are using features, you can save tour facet and the date range.

And then, you can modify them.

oldspot’s picture

I'm facing the same issue and I have started debugging the whole form build process with Xdebug to see what it's trying to do.
I noticed the whole of "settingsForm" function in the class "Drupal_Apachesolr_Facetapi_Widget_DateRangeWidget" gets called twice so i started following the form calls before it reaches that.
Basically in the file facetapi.admin.inc in the facetapi module, when all the widgets get built to be displayed in the facetapi_facet_display_form function, the $plugin->settingsForm($form, $form_state); gets called once for Drupal_Apachesolr_Facetapi_Widget_DateRangeCheckBoxesWidget and once for Drupal_Apachesolr_Facetapi_Widget_DateRangeWidget, and since the checkbox one extends the normal one they both use the same "settingsForm" function.
For some reason the whole 'date range' form gets 'replaced' by the 'date range with checkboxes' one, instead of having two separate forms technically.
I noticed that if I change for example the text "Past year" to let's say "Past years" in the 'date range' form, and then switching the "Display widget" to 'date range with checkboxes' that whole settings form stays exactly the same, which it shouldn't really since they should really have different settings forms since they are different widgets.

This is actually the reason why the "Add new date range" doesn't work - the form gets called once for the 'date range' settings form and then $form_state['add_new_range'] = FALSE; gets run. The second time the settings form is called for 'date range with checkboxes' that 'add_new_range' is not TRUE any more so it doesn't add the new line to add a new date range.

Technically commenting out $form_state['add_new_range'] = FALSE; makes it work (even after clearing caches unlike #14 and #15) but it's just a 'work around' - does not fix the fact that technically 'date range' and 'date range with checkboxes' have the same form and cannot have different settings.
Looking at other widgets though I see that the ones that extend other classes all face the same issue, so maybe this is more of a 'facetapi' module issue?
Sorry for the long 'brain dump' but wanted to write down all the debug findings in case it helps others.

  • eugene.ilyin committed 039aa0c on 7.x-1.x
    Issue #2156193 by codium, idevit: Not allowing me to add a new date...
eugene.ilyin’s picture

Status: Active » Needs review

@oldspot is right.

I have corrected this error. For me it works, but would be nice if somebody will test it.

eugene.ilyin’s picture

Status: Needs review » Fixed

Let's decide it as fixed. If it will not work, please create new issue.

Bohus Ulrych’s picture

Hello @eugene.ilyin
on my side this fixed my issues (latest dev version 2016-May-26)
Thank you!

Status: Fixed » Closed (fixed)

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