I tried creating views using the following 3 views version
views 6.x-2.0-rc5
behavior: As expected (Exposed filter shows as the default option)
views 6.x-2.0
behavior: As expected (Exposed filter shows as the default option)
views 6.x-2.1
behavior: Not as expected (Exposed filter shows the first term of the list(in my case taxonomy term) as the default option)
I don't know if I have missed something . I have used the same view across all 3 view version .
I have cleared views cache .
Please guide me on this . I am attaching my views export file as well as the log file for all the 3 views in use .
I am attaching the log files for views 6.x-2.0 and views 6.x-2.1 as comments as I think I have exceeded the upload limit .
Comments
Comment #1
junedkazi commentedI am not able to Attach log file for views 6.x-2.0 & views 6.x-2.1 as they
are exceeding the upload limit .
If you require it I will copy paste it .
Comment #2
marcingy commentedWe had a similar issue and after some tracking down we seemed to find indications that the issue was being casused by this line of code
Amending to
<?
if (empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
$form_state['input'][$identifier] = $default_value;
}
?>
resolved the issue not sure if this is the right solution but it appears to 'work'.
The underlying syptom is that even though exposed_translate in views_filter_handler adds the any value and sets the #default to all upon initial rendering this values is ignored and the value stored in $form_state['input'][$identifier] is used.
Patch attached
Comment #3
junedkazi commentedmarcingy
Thanks for the quick reply . I will try the patch and get back in this issue .
Till then I hope to hear from MerlinofChaos what he thinks of this and his
opinion about the patch .
Thanks
Juned Kazi
Comment #4
junedkazi commentedI did check the patch . It did work . But the only question in my mind is
the same code is used in rc5 and 2.0
if I have checked correctly and its is working fine . Then why is it breaking
down for 2.1 . There has to be some other reason .
I will try and debug it this weekend and if I find the problem I will report it back .
Comment #5
dawansv commentedSame problem here. What I found however is that selecting the "Limit list to selected items" option in the filter gives the expected behavior of Any selected by default. It's only when that option is NOT selected that it seems to give the unexpected result of selecting the first actual item in the list (instead of Any).
Comment #6
junedkazi commentedI think many people have come across this behavior . SO changing the
category to bug report .
Comment #7
merlinofchaos commentedOk, the patch makes no sense.
That particular piece of code is dealing with the fact that #default_value doesn't work entirely as expected during $_GET based forms. So what it's doing is placing a proper default in the input if one doesn't exist. The way that code is changed it basically just deactivates the code entirely, which will break other setups.
I've tried testing this a couple of different ways, and in my tests the $default_value is always being set correctly. In the view that was exported, please note that the fact that you have items selected is causing the issue. Please ensure you do *not* have items selected; selecting items when the filter is exposed sets the default value. Because you can select multiples but the exposed filter form only accepts one, the first one you selected is the default.
Comment #8
nachenko commentedI've found about the same problem here.
This is the problem:
1 - I have a profile field defined with one checkbox: Yes / no. That's all.
2 - I have a Views with a exposed filter for this profile field. Filter is set to "optional". Remember is set to "no". No values are selected in the filter config. It appears as two radio buttons, yes/no.
I expect the filter to get all values by default, but when I read the query, I notice this is taking "0" (box unchecked) as default value. This is a part of the query:
WHERE (profile_values_my-value.value = 0) ...This happens with all profile fields I've defined as checkboxes.
Comment #9
arx-e commentedAh! you just saved me with this "Limit list to selected items" option!
How about being able to select what value(s) are selected to filter the results in the default view? Isn't this badly needed?
Comment #10
colanAdded some help text for this in http://cgit.drupalcode.org/views/commit/?id=24188c4 for 7.x-3.x.
Feel free to provide a patch for backporting to 6.
Comment #11
rv0 commented@colan
Just noticed that help text after updating my 7.x-3.x version..
Uh... It's quite confusing and totally looks weird when using something like BEF.
And there's no way to hide it?
I really don't see how this text is helpful in any way:

Comment #12
colanAs long as this works properly with plain ol' regular Views, I'd recommend opening a new ticket for this in the BEF queue (unless there's one already).
Comment #13
rv0 commented@colan

Even without BEF it looks weird and confusing:
What I mean is that I'm not fond of adding lengthy descriptions that cant be changed (...) to the front end of a website..
Especially if they don't make any sense at all, which is the case here.. How does it even make sense to leave a single select "blank" ?
Maybe there's something else wrong on my site modifying this.. I should check.
Comment #14
neuquen commentedAfter applying the patch from @colan in #10 the description text is showing up on the front end of our application in an exposed filter. Meaning end users will be able to see it. This is happening with and without BEF.
Comment #15
neuquen commentedAfter some digging I believe I found the issue. The description is being added in, but when it hits the exposed_form function in views_handler_filter.inc the description text should be removed for the current exposed element ($this->options['expose']['identifier']).
I'm uploading the patch for your review.
Comment #16
colanMoving this back to Views until we get it resolved there.
Comment #17
dhalbert commentedThe text --
Leave blank for all. Otherwise, the first selected term will be the default instead of "Any"-- . showed up on my BEF exposed filter when I upgraded to Views 7.x-3.12. As a workaround for now, I am using String Overrides to replace the text with nothing (rather than apply the patch).I'm also quoting the "Leave blank" text in the comment here so search engines will pick it up. I think this may start showing up widely as people upgrade Views. It took me a while to find this relevant issue.
Comment #18
adwuk commentedJust had this issue after upgrading to views 7.x-3.12. The patch from neuquen in #15 appears to work fine.
Comment #19
Jedd Casella commented#15 removes the backend text and realigns the exposed filters but then adds the text "Select terms from vocabulary vocab_name" underneath the filter label, in my instance (drupal 7.41 & views 7.x-3.12).
Comment #20
donaldp commented3.12 is officially broken anyway and has been replaced by 3.13. I suspect that won't last long either if this issue persists. I've reverted to 3.11 in the meantime until I get a chance to test 3.13.
It would appear that the messages appear on the front end with 3.13 as well so will stick with 3.11.
Comment #21
hawkdavis commentedI am having the same issue, not just with one site but multiple sites all doing the same thing.
Leave blank for all. Otherwise, the first selected term will be the default instead of "Any"Other than this being annoying it does not seem to break any functionality. yet.
Comment #22
Rafal LukawieckiI can confirm that since upgrading to 7.x-3.13 I also get the message "Leave blank for all. Otherwise, the first selected term will be the default instead of "Any"" next to BEFs. Tried updating BEF to current Dev version, did not help.
Will revert Views back to 3.11.
Comment #23
BigBrother2010 commentedUpdate to 7.x-3.13 and getting description too.
Just for the test i added some other description in BEF and it displays ok (i tried random text, then tried "< blank >" and got same error on both occasions, altough "< blank >" works and hides the description.
Error:
Notice: Undefined index: vid in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 990 of \sites\all\modules\better_exposed_filters\better_exposed_filters_exposed_form_plugin.inc).
Comment #24
dman commentedThis update (adding the text "Leave blank for all. Otherwise, the first selected term will be the default") caused regression on existing sites, by displaying new, un-modifiable text, where previously there was none, and breaking the layout of previously-themed forms.
Regression introduced here:
http://cgit.drupalcode.org/views/commit/modules/taxonomy/views_handler_f...
Editing the 'description' by way of views UI just appended to it and there seems to be no clean way to make this set text go away now.
Comment #25
dman commentedComment #26
neuquen commented@Jedd Casella
My patch does not add any new text. It only unsets the description text so that text must be coming from somewhere else in your code.
Comment #27
cilefen commentedMy clients just noticed this and started complaining. I patched Views, removing the #description array element.
Comment #28
niek_kloots commentedI solved it by removing line 198
'#description' => t('Leave blank for all. Otherwise, the first selected term will be the default instead of "Any".'),from modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc
Comment #29
func0der commentedYep, this description has to go.
A even bigger bug is that the description I can add to a view filter via the UI, it does not replace the description but adds another div to it.
Comment #30
pvasili commented#28 the best way to remove this bag
Comment #31
kaztur commented#28 solves bad appearance of views.
Comment #32
francoud commentedHad the same problem. Introduced since views 7.x-3.12 I think. Should be applied to latest version and -dev also, IMHO. I hate to patch sources :(
Comment #33
lotyrin commentedDocumenting this this way is an arguable win, but it should have been conditional that I'm in the admin UI. (The opposite of what the "Fix" in #15 is doing.) The message is for that one form, it should be added for that one form, not added universally, then removed for exposed forms. Hypothetically I could be reusing filters' form elements from within a complex template and not via exposed filter form, and it shouldn't show up then either.
It's pretty disappointing that for such a high profile contrib module, this change made it straight into a stable release without getting caught, and remains in the current stable release without a fix several months after its introduction when it is so easy to improve. Even if an improved solution was complex it could easily and immediately be reverted while the improved solution is developed.
Comment #34
lotyrin commentedComment #35
lotyrin commentedI don't like it, but everything else in here seems to assume a duality between exposed form|options form and I won't fight that, so I placed this in an existing conditional, preventing it from appearing on exposed forms.
Comment #36
lotyrin commentedAnd here's a patch from scratch, attempting to follow d.o's standard and make the test bots happy.
Should there be any any question of applying this, please do not delay and please instead apply the revert patch above. There is no excuse to nitpick and leave people's sites broken.
Comment #37
webservant316 commented#28 fixed it for my. wow upgrades today followed by more patches.
Comment #38
oriol_e9gInstead of haking views it's better to remove this new unremovable description in a custom module.
This is my temporally fix:
Comment #39
keesje commentedPatch in #36 confirmed as a working solution
Comment #41
colanI was finally able to reproduce this. I committed #36 with an added comment.
Let's do the same for D8.
Comment #42
cilefen commentedComment #43
dawehnerYeah, that totally makes sense. For now adding new strings is probably more of a
8.1.xissue ...Comment #47
donaldp commentedThe patch in #36 appears to be working for me.
Comment #48
cilefen commented@donaldp that is good to hear because it has been committed.
Comment #53
catchCommitted/pushed to 8.1.x, thanks!
I think adding strings is probably OK in patch releases - it doesn't require a re-translation, just a new translation, and a single untranslated string in the Views UI isn't going to notice much, but for now moving to 8.0.x and leaving RTBC in case I've got that wrong.
Comment #54
dawehnerI've seen other issues which allowed string additions, though I don't remember which ones.
Comment #56
catchYeah I think it's fine, we should document this better though.
Cherry-picked to 8.0.x, thanks!
Comment #57
svdhout commentedThe patch at #36 results in notices from better_Exposed_filtersNevermind, there was stil a space left in the better_exposed_filter description, removing it made the notice go away