By johnhanley on
I'm sorry if this is documented somewhere, but it's been a long day and I can't seem to find the answer to something that should be super easy and obvious.
I have a views exposed filter that contains a handful of taxonomy terms and need to set the filter default to <any>. However the exposed filter always defaults to the first term following <any>. I have tried this with the "remember" option enabled and disabled, but it doesn't make a difference. The filter itself works great--just can't set the default to <any>.
Can someone give me a nudge? Thanks!
Comments
If I'm not mistaken, the
If I'm not mistaken, the 'Optional' checkbox does this, but only when you specify no filter values and do not select 'Limit list to selected items'.
This is correct, you just
This is correct, you just need to also use CTRL and clicky all the individual items in the list; specifically SELECT ALL. You will also need to uncheck required just above the label area to utilize any. This will give you "Any" and default as it.
Scott Browne
www.coverclubmedia.com
You are correct
This should be very easy but isn't. I still haven't figured out how to accomplish this in D6. If you select "Optional" it should default to "Any" and not whatever the first item on the list is. Users expect to see all results and then be given the ability to refine the results by selecting a taxonomy filter.
subscribing
also can´t find out.
I cant find the right hook for it...
This worked for me...
Okay, so I came here looking for the same info. After noodling around a little more I found a solution that works for me.
My view now defaults to - Any - on each page render
My settings:
[Operator] = is one of
[Options] = uncheck all items
Then, at bottom, check [Optional] and [Force single]
Now if I can just figure out a way to display a message if the user selection option has no result to display :-)
empty text
3duardo, thanks for sharing your findings.
Use the "Empty text" input for the corresponding page view to define the empty results text.
-------------------------------------------------------
"If you don't read the newspaper you are uninformed;
if you do read the newspaper you are misinformed."
-- Mark Twain
Duh! - slaps self
I do this for all other views when appropriate but went brain-dead on my first exposed filter view.
Thanks
+1 for this solution. Note
+1 for this solution. Note that you might not notice right away that it's working if you have "Remember" checked. But if you kill your session and reload the page, you should see that Any is now the default.
Thanks
Selecting "nothing" to see everything is finally so obvious ;-) Thanks for this solution. Works great !
David THOMAS
http://www.smol.org
"uncheck all items"?
I'm struggling with the same issue and cannot find the "uncheck all items" option you mention. Is that the correct label? Thanks.
solved
I didn't realize you meant that you actually deselected all the options in the select field that contains the cck terms. This thread set me straight: http://drupal.org/node/339384#comment-1188047
Sorry. Sunday morning and no caffeine makes Jack a slow boy.
solution
Yes, you are indeed correct. The solution to default an exposed filter to
<Any>is to deselect all the options and leave "Limit list to selected items" unchecked.Thanks
This worked for me D7 .. :)
The only drawback I can see
The only drawback I can see from this solution is that there are cases where you do not want all items to show in the list (ie content types that aren't available to all users).
Thanks you!
Saved me a bunch of time! Seems obvious when you hear how to do it!
-jweedman
Worked!
ROCK! Thanks for this A+++++ solution. So simple, yet so tricky.
Let me explain something to you. Um, I am not "Mr. Altuna". You're Mr. Altuna. I'm the Greg. So that's what you call me. You know, that or, uh, His Gregness, or uh, Greggie, or El Gregerino if you're not into the whole brevity thing.
That worked for me too.
Thank you. I'd been fooling with that one for a couple hours. :(
thank you
I was looking for the exact same thing ... didn't consider unchecking all of the options!
Any way to have the search appear
without the results on the first view? ie until the user actually selects and submits? When I hit my search page now I get all the items available beneath the search/sort boxes without any action from me.
second this request
I also have a view that I want to remain empty until the user starts selecting - I don't want all the view results to appear automatically - is there a way?
I try this and get the following error:
I create an Exposed filter for a Taxonomy: Term
I selected "is one of" and didn't check any of the boxes
Below that I checked "Force Single" and "Optional"
I click Update
I get the following error: An illegal choice has been detected. Please contact the site administrator.
I look at the log and it shows the following:
Type form
Message Illegal choice 0 in tid_1 element.
Severity error
If I save it, it then shows the default as < any> but is highlighted red and giving the error: An illegal choice has been detected. Please contact the site administrator.
I have an exposed filter above it that does the exact same thing... and works... I replicate it with anything (even the same term) and it gives me that error.
fixed
this was a conflict due to the "better select" module, after uninstalling the module all worked well again
Keep Better Select
Note that you can also make it work while keeping better select (a great module!) enabled:
Go to Site Configuration ---> Better Select, from there you can tick the "Node form only" box, which displays better select checkboxes only on node forms.
That sorts the conflict! :-)
Try renaming the Filter
Try renaming the Filter identifier to x or x2. This seems to do the trick for me. I was getting this problem with and without the better select module.
Hydrant Ltd
www.hydrant.co.uk
Replacing the <Any> label
Do you have any idea how to replace the label with the Filter name or any label of my choice? I actually want the filter to display the filter name as default instead of ""...
Thanks,
Renaming filter did the trick!
Thanks djmystic82, changing the filter identifier from 'typ' to xx solved the issue for me!
worked for me too. thanks
worked for me too. thanks
Or you can disable Better
Or you can disable Better Select whilst setting up your views and then re-enable it when done.
I had to do it that way as I wanted checkboxes in User Profile taxonomy terms, with "Node form only" selected I lost the checkboxes as its not a node
This simply doesn't work for
This simply doesn't work for me if I have an argument set to a taxonomy term from a different vocab. Defaults to the first term always.
I have two arguments. The first one is one of two terms, either male or female from a Gender vocab, the second is the Country subfield from a Location CCK.
If I set the exposed filter to another vocab (call it Boutique Categories) using Taxonomy: Term ID exposed filter it will always default to the first category in my Boutique Categories vocab, regardless if I select it or not.
Let's say I add the filter and not expose it, I get this query:
As soon as I expose it, with settings Force Single: On, Optional: On and Is one of: (no selection) the views query becomes
You'll note that now term_node.tid = 7 exists, as if by magic. This is the tid of the first term in the term selection list, despite having nothing selected. Hence my view always defaults to this, and never defaults to Any.
Anybody have any ideas with this one? Is there something I'm not getting?
I should note, this issue
I should note, this issue disappears if Force Single is set to off, and the query also changes. (ie multi-select box)
Same problem... somehow fixed
Lucky number 7! My magic number was 40, kinda boring. Maybe if you rename the "Filter identifier" field in the exposed filter it will fix itself. For example changing "term_node" to "term_somethingelse". I'm not sure why, but this worked for me. However, if I change too many settings with "Force single" turned on, it starts doing the same thing, but with different numbers.
Some more information on my
Some more information on my settings in case it would be helpful:
Operator: "Is one of" (with everything selected)
Reduce duplicates: ON
Unlock operator: OFF
Optional: ON
Force single: ON
Remember: OFF
Limit list to selected items: ON
Second that on the settings
Limit list to selected items: ON
worked for me
Work, but only when..
These settings work, but only after I change the default "Filter Identifier" to something other than the default. Strange.
Same here, the above
Same here, the above solutions didn't work for me until I changed the default "Filter Identifier".
Thanks for this solution
This worked for me
Thankyou
Works great. Thank you Eduardo.
thank you
Thank you, this helped me a lot. Solved me a problem I couldn't solve for a month!
Thanks 3duardo
Excellent painless solution. Thank you!
Making Any be the default selection in Drupal 7 Exposed Filter
I had this problem in Drupal 7 and stumbled upon this thread. It's a little different, so I thought I'd post what I figured out from hints about D6 in this thread.
Add a filter and Expose filter to visitors.
Choose Single filter, give it a label, choose "Is one of" under Operator, and have no terms selected/highlighted in the "Select terms from vocabulary" box. The only option checked under the vocab box is "Display error message."
This setting defaults to in the dropdown list.
Thank you for taking the time
Thank you for taking the time to summarize this for D7 users.
Thank you!
The above solution works perfectly. I could CTRL- or CMD-click to unselect the items in the box.
I wouldn't have found it without your help. Thanks!
Added missing help text
The ticket for this is #339384: Default option <Any> not set in exposed filters when terms are selected. With the new help text, this should be clearer.
you are right @staceyb dont
you are right @staceyb dont choose any one in Options
https://www.drupal.org/project/image_captcha_indicator
https://www.drupal.org/project/ext_js
Thanks for these instructions
@staceyb Thanks for these instructions, worked great!
setting views exposed filter default to <any>
This is right, you simply need to additionally utilize CTRL and clicky all the individual things in the rundown; particularly SELECT ALL. You will likewise need to uncheck obliged simply over the mark region to use any. This will give you "Any" and default as it.
Hello,
Hello,
I have the same question but the answer given don't work for me, here are my filter exposed settings:
single filter type, labelled, is part of, no selection at all in the vocabulary box, not selection at all under this box.
However, the default radio button is the one just after the "any" button.
Any ideas ?
Bye