Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using a fresh test site, I've created a very simple Event content type (just title, date and body) and configured VGF to filter views by the date field, which is just dd/mm/yyyy.
As showned in the attachments, the node form is all right but the filter form (placed on Highlight region) displays the field duplicated.
The only configuration different from the default I've made was marking Invoke widget immediately upon select.
Comment | File | Size | Author |
---|---|---|---|
#15 | image1.png | 33.6 KB | joao.delgado |
#3 | gf with 3 auto-submit.jpg | 104.11 KB | RdeBoer |
Test7 2012-12-19 09:56:35.png | 50.78 KB | 3magnus | |
Test7 2012-12-19 09:56:01.png | 44.68 KB | 3magnus |
Comments
Comment #1
3magnus CreditAttribution: 3magnus commentedAs I see it now, it's suposed to be a date range (although I didn't wanted that) and there is a major bug with CTools autosubmiting textfields.
Anyway, eliminating the autosubmit option doesn't make VGF work with Date fields (but for a normal view filter it does) and the following errors keep being displayed:
If someone could show me a working configuration of a global filter for a Date field (just date, without time) I would appreciate it very much.
Comment #2
RdeBoerAs explained in the Views Global Filter documentation, a date field will ALWAYS display as a range (from start date to end date) . It would be very limiting if you could only filter by a single date!
Auto-submit was developed for the simple widgets -- it may not work for all inherited widgets, like Dates.
As for the Warnings, I will look into them. Suspect you have a very recent version of PHP?
The README of the module has a special section on Dates (copied below). Did you follow it?
On my system I have just tested on 7.x-1.x-dev a date field on a custom content type. It's Global filter works with the 3 available widgets (triple-select, popup calendar and text field) and all three work with or without the "Invoke widget immediately upon select" box ticked.
For the text field the default format on my system is "20 Dec 2012"
GLOBAL FILTER FOR DATE OR DATE RANGE
==========================
If your content does not already have a date field attached, add one as per
normal via the Manage Fields tab on the content type page. You may pick any of
three Date types, i.e. plain, ISO or Unix Timestamp. Just be aware of this bug
in the Date module: drupal.org/project/node/1477180. So until this is fixed,
maybe avoid Unix Timestamp. When prompted pick any of the available date
selection widgets, e.g popup calendar or the triple select list. You may tick
the "Collect an End date" box too, if you wish. After you have configured on
the block configuration page a global filter for the selected date field or
range, the global filter will render itself using the same widget you picked for
the field on the content type. However, the global filter will always appear as
a date range. Filtering on a single date would be a little restrictive!
Finally, as with any other global filter you need to hook it into your view as
a contextual filter. Use either just the field start date or create a second
contextual filter to also require the content's end date being inside the
filter range. In either case scroll down the bottom of the contextual filter
panel to the heading "Dates to compare". Press the button "Only this field".
Comment #3
RdeBoerAttached a snapshot of a working example of a View driven by a single Global Filter block containing three field filters, all with "Invoke widget immediately upon select" (aka auto-submit) ticked. That's why there is no "Set" button. If one, two or three of the widgets were NOT auto-submit there would be a Set button for those, but still allowing the other widgets to auto-submit as well.
The Date filter in this example is a plain Date field (not a Date ISO or Date Unix field, although these work too) and the widget is a popup-calendar (although triple-select and text field work fine too, with or without auto-submit).
The location drop-down is a plain select (not inherited) and the price category is the "options_buttons" widget, which is inherited from the original field.
Comment #4
RdeBoer@3magnus:
Are you filtering by a FIELD (one whose names starts with field_...) or a "Content property" like "Content: Created date (CCYYMMDD)"
Comment #5
RdeBoerClosing due to inactivity and the fact I cannot reproduce this.
Comment #6
iaminawe CreditAttribution: iaminawe commentedHi,
I just wanted to ask a question relating to whether its a field or a content created date.
With a field it seems to work correctly for me and I get date pickers I can use to set the date range and my content is filtered.
In another instance I need to use the content post date and the most relevant field I can see to use would be Content: Created date (CCYYMMDD) but using this I cant seem to get it to work properly and I cannot seem to get the date pickers or dropdowns, only a text field.
Thanks
Gregg
Comment #7
RdeBoerHi Gregg,
Yes because Created (Posted) date is a node property, rather than a field, it does not have a widget attached and so the widget that will come up is a simple text box.
What I've just realised is that in thw case of dates the module only presents one textfield i.e. for an exact match. For dates, this should be 2 boxes, so that start and end dates can be entered.
Changing to feature request.
Rik
Comment #8
iaminawe CreditAttribution: iaminawe commentedThanks Rik, unfortunate to find that out now - I have 350000 nodes that are going to need a re-import to map the date to a date field.
Thanks for the clarification though and for an awesome module
Gregg
Comment #9
RdeBoerHow long can you wait? I may be able to do something this weekend. Rik
Comment #10
iaminawe CreditAttribution: iaminawe commentedDoing a fresh import will take over week of cron running every 3 mins and importing 300 feeds items - I would be happy to wait until Monday before starting to batch import everything again.
If I need to re-import everything its only time it will take to update the new date fields so it will be a background process for a week and up until then the only thing that wont work correctly is the global date range which I can live without for a week or two.
It would be amazing if you could implement it to work with the core date field but no pressure - enjoy your weekend.
Comment #11
RdeBoer@iaminawe, #10:
Ok, some relief... but we're not quite there yet.
As mentioned, the "Created" and "Updated" node properties are architecturally different from Date fields.
"Created" and "Updated" date ranges are not supported by core, but are supported via the Views Contextual Range Filter module (using the latest 7.x-1.x-dev snapshot of 28 July or later).
When used in combination with Views Global Filter, the date range UI widget comes up as a pair of TEXT boxes -- not pop-up calendars, yet.
This may or may not be good enough for you, considering that without further widgetry the format to be used in text fields for start and end dates is dictated by Views, i.e.
YYYYMMDD, e.g., 20130729 or year-only, year + month, month-only, week only or day only.
That's how far I got...
Rik
Comment #12
iaminawe CreditAttribution: iaminawe commentedThanks so much for the progress and possible workaround - I will take a look at the views contextual range filter and the combination to use for the short term but will likely re-import anyway to map the dates to field to use the available widgets.
Thanks so much for the assistance, much appreciated.
Comment #13
RdeBoer"Created" and "Updated" date ranges are supported as text boxes. The Views Contextual Range Filter module is required for this type of date.
I'm postponing the implementation of Date-module style calendar picker for the node creation and node updated date properties as a feature request.
I simply don't have the time right now.
Patches welcome.
Rik
Comment #15
joao.delgado CreditAttribution: joao.delgado commentedglobal filter by date reverses the day and month as the picture shows
Comment #16
RdeBoer@jhmdmgae, #15
I am not so sure about your assertion. Input formats and output formats may be different.
Note: this issue was about the node creation and modification dates... Is that what you're doing (in combination with the Views Contextual Filter Range module)? Or are your textfields for Date fields (as opposed to date properties?)
Rik
Comment #17
RdeBoerComment #18
stevecory CreditAttribution: stevecory commentedI'm needing help with Drupal 7.36 Global Field using a Date field with a Pop-up Calendar Widget.
It has no default date set in the Content type.
I'm setting:
Views, Contextual Filter, When the filter value is NOT in the URL, Provide default value,
Type = Global filter (field or search term) and Dates to compare= Only this field
all other settings are unchecked.
Which results in:
Notice: Undefined index: #title in theme_date_combo() (line 375 of /var/www/html//sites/all/modules/contrib/date/date.theme).
Here's a portion of sites/all/modules/contrib/date/date.theme
. . .
/**
* Returns HTML for a start/end date combination on form.
*/
function theme_date_combo($variables) {
$element = $variables['element'];
$field = field_info_field($element['#field_name']);
$instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
// Group start/end items together in fieldset.
$fieldset = array(
'#title' => field_filter_xss(t($element['#title'])) . ' ' . ($element['#delta'] > 0 ? intval($element['#delta'] + 1) : ''), /* LINE 375 */
'#value' => '',
'#description' => !empty($element['#fieldset_description']) ? $element['#fieldset_description'] : '',
'#attributes' => array(),
'#children' => $element['#children'],
);
// Add marker to required date fields.
if ($element['#required']) {
$fieldset['#title'] .= " " . theme('form_required_marker');
}
return theme('fieldset', array('element' => $fieldset));
}
. . . and I need to know what I'm missing.
Thank you for your help.
Comment #19
RdeBoerReopening from closed (so it won't go unnoticed).
Thank you, Steve, for your report.
I don't have a solution right now, but I hope to get back to you.
Rik