Hello,
I am trying to create a search block from a view using the "dependent views filter" module. The search feature is meant to search several content types by fields set as filters. The content types are "vehicles", "merchandise", "jobs" and "tenders". When someone selects the "automobile" content type from the drop down menu, then it is supposed to show the "vehicle make", "Year of make" (start and end date fields), "price" select field etc. Unfortunately, global dependent filter is working fine for the "automobile - global dependent filter- vehicle make" combination but it does not work properly for the select drop-down fields of "vehicle make - global dependent filter - vehicle model" combinations.
The date fields set as filters are also still being displayed even-though they have been set to hide.
I don't know if this is a bug or I'm not doing something right. Please help.
I'm using drupal 7.12
views: 7.x-3.3
Views dependent filter: 7.x-1.0
I would be really grateful for your assistance. What the module can do is exactly what I am looking for.
Comments
Comment #1
Tara1981 commentedI'm having the same problem with date fields
Comment #2
Tamanda commentedComment #3
trailrunner commentedI'm also having the issue. The date field is not hiding. I am showing both start and end dates in the exposed filter.
Comment #4
ansari commentedsame than trailrunner, and it doesn't work..
Comment #5
Foonaka commentedSame problem here. The date fields always show, no matter what.
Comment #6
eminencehealthcare commentedSame problem here.
Does anyone know of a way to do this manually? Maybe with a hook_form_alter?
Comment #7
muki91 commentedHas anybody been able to solve this problem ?
Comment #8
Tetris7 commentedHi, i got the same problem. If i add a exposed date filter and set a dependent filter still showing this field always
Comment #9
ashokthube commentedHi, I got the solution for above issue.
As date field dose not having ['#pre_render'][] = 'ctools_dependent_pre_render'; as this was included in date module but it will not in rendered in dependent module.
Fixed
In views_dependent_filter.module file
// Set the dependency on each form element as required.
foreach ($dependency_info['dependents'] as $dependent_filter_id) {
$identifier = $dependency_info['identifiers'][$dependent_filter_id];
$form[$identifier]['#process'][] = 'ctools_dependent_process';
// You should have to make it conditional only for Date field you can add the condition because other fields having ctools_dependent_pre_render
+ $form[$identifier]['#pre_render'][] = 'ctools_dependent_pre_render';
if (!isset($form[$identifier]['#dependency'])) {
$form[$identifier]['#dependency'] = array();
}
$form[$identifier]['#dependency'] += $form_dependency;
}
Comment #10
mustanggb commentedBased on #9 I think it's preferable to fix this in the date module, I've added a patch to #1177198-14: Allow CTools to process #dependency for date elements.