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.
Hi, everyone. I have two date fields, how to create only one date exposed filter for two this field. I tried "Global:Combine field filter" and views filter populate but can't not resolve this problem. Thanks.
Comments
Comment #1
Iceabenezer CreditAttribution: Iceabenezer commentedSame issue here. I have to have two different date fields because I have to collect different granularity depending on the product selected. Any thoughts?
Comment #2
morrisem CreditAttribution: morrisem commentedAfter struggling with this same issue, I "solved" it by creating two exposed date filters with Filter identifiers "f1" and "f2", hiding f2 via CSS, and then using the Javscript injector module to inject the following jQuery into the page with the exposed filters:
Thus, whenever f1 is changed, f2 is set to its value, so both filters test against the same thing, but only one field is presented to the user. A bit hackish, but it's the best I could figure out.
Comment #3
P2790 CreditAttribution: P2790 commented@morrisem
I have been trying your code, but it just doesn't seem to work. Nothing seems to happen
Are your exposed filters using the date popup
Comment #4
P2790 CreditAttribution: P2790 commentedI used:
Also using the preprocess and the header in js injector
Comment #5
jincy_k CreditAttribution: jincy_k commentedI also have a similar requirement. In views exposed filter, I need to show a start date and a select field for showing the number of weeks. User on selecting the start date(pop up field) and number of weeks, I want to calculate and populate the end date field. In hook_views_query_alter, I'm trying to alter the conditions. But no luck for date filter. Please help me with a reply. Please correct me if I'm doing something wrong.
Comment #6
DamienMcKennaAs a reminder, the "assigned" field is for indicating that you're actively working on something.