Needs review
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
exposed filters
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2012 at 19:11 UTC
Updated:
23 May 2019 at 08:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rob230 commentedI found exactly the same thing. When adding an exposed filter for a fulltext search I had entered some nonsense text while testing, then later I unchecked 'Remember the last selection'. But every time I returned to the page it was back again, and nothing I did in the settings would get rid of this nonsense text from appearing the search field. If I searched for something else it wouldn't wipe it out. Even after deleting the filter and adding it again it still persisted.
Later on I re-enabled 'Remember the last selection' and then searched for a blank string, then disabled 'Remember the last selection' again and this has the desired behaviour of the search form being blank when I first visit it, but I feel like it was a fudge and that this is being stored in the database somewhere due to this bug.
Perhaps someone who knows how the selection is remembered per user could shed some light. Changing the name of the field fixed it but changing it back made the remembered string come back.
Comment #2
dawehnerit's stored in the session, so you could clear that and then everything would be fine.
Another way could be to actually check in the specific code not only that something is in the session,
check for that "remember last selection" checkbox.
Comment #3
codesidekick commentedRan into this issue today.
Very easy to recreate:
This is because $view->get_exposed_input() checks for the existence of the session variable but doesn't check to see if the filter still allows remember. Because the session variables don't get cleared, the session variables from before remain.
Clearing the session variables could work however it might be destructive (what if I accidentally ticked the 'remember' checkbox, realised I'd made a terrible mistake, and all my users remember options were cleared) so this patch addresses the issue simply by checking whether each filter in the current display has the remember option enabled.
Let me know what steps I can do to get this into the D8 version (if it suffers from the same issue).
Comment #5
codesidekick commentedChanged version number to dev.
Comment #6
codesidekick commentedRe-queued for testing.
Comment #7
codesidekick commentedComment #8
Wtower commentedThe patch for me works fine and solves the issue.
Before the patch I had to disable 'exposed' for the fields that I wanted to clear the 'remember' value, but keep them and add them again second time with 'exposed' on.
Comment #9
basvredelingYes, this indeed solves the mysterious persistence of exposed filter values. For me the issue emerged in a geofield proximity field.
Comment #10
basvredelingPatch from #6 still applies.
Comment #11
higherform commentedI just ran into this issue using views 7.x-3.13 ... I'm curious to know why #6 never got committed? I assume it just fell out of sight and out of mind of the maintainers...I'm upgrading this to major because of the troubleshooting time it took me to figure it out, and the fact that I cannot figure out how to delete the remembered value from the mysql DB, which means a contrib module coded view is now broken....I think the problem might actually be this bug: https://www.drupal.org/node/1349080 instead. Linking here in case anyone else gets confused in troubleshooting as I did.
Comment #12
dawehnerMH, I'm not entirely convinced by this solution ... we still copy all the values from
$_SESSION, ignoring different configuration on different filters.Comment #13
higherform commented@dawehner -
Do you have a different / better idea about how to solve this, then?
Comment #14
higherform commentedUndoing my promotion of the bug from normal to major.
Comment #15
anup.singh commentedComment #16
anup.singh commentedAs per the comment #12, I have modified the patch with one extra condition.
Unset session if parameter exist in case remember selection is not enabled or disabled.
Re-queued for testing.
Comment #17
chris matthews commentedThe 2 year old patch in #16 to view.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.
Comment #18
zekvyrin commentedRe-rolled patch from #16
Applies cleanly to current 3.x-dev & 3.23 (same code at the moment) & fixes the issue.