I'm using the HS module in an exposed Taxonomy Term filter in Views. I want to set the default filter settings to "< none >" in order to force the user to make choices before any results are displayed. However, in doing so I keep getting an initial red box "field is required" warning when the page first loads, and there is a red border surrounding the selection menus. Furthermore, after the user makes his/her selections and applies the filter, a second "field is required" warning appears. Am I doing something wrong or is there a way to turn this behavior off? The View is functioning exactly the way I want it to without these warnings.
Here is the page to my view:
http://fsotest.web.arizona.edu/students/fees
Comment | File | Size | Author |
---|---|---|---|
#21 | 762920-21.patch | 1 KB | Wim Leers |
#20 | hierarchical_select_762920_20.patch | 1.04 KB | scottrigby |
Comments
Comment #1
Wim LeersJust make the exposed filter *optional* in the Views exposed filter settings :)
Comment #2
gallegosj CreditAttribution: gallegosj commentedThanks for the reply.
Setting the exposed filter to "optional" adds "< Any >" to the filter options, which defeats the purpose of the view. For this view, a user *must* choose from all options in the hierarchy in order to display valid results.
Comment #3
gallegosj CreditAttribution: gallegosj commentedChanging status back to active.
Setting the filter to "optional" defeats the view. If the exposed filter is required (not set to optional) then the red box warning and red border are really just redundant and unnecessary. Or do they serve another purpose?
Comment #4
Wim LeersYou're right, that makes absolutely no sense! It appears that Views is doing something that it shouldn't do, which makes HS think it has been submitted, while it clearly hasn't when it's being displayed for the first time …
Unfortunately, I don't have time to dive into this deeper.
P.S.: Please do upgrade to 3.1 first and confirm that the problem still exists there, but I'm fairly sure it does.
Comment #5
gallegosj CreditAttribution: gallegosj commentedUpgraded my version to 3.1 - problem still exists. Thanks!
Comment #6
Wim LeersThanks. But … let me repeat myself:
So either you'll have to wait quite some time or you should start debugging this yourself, I'm afraid …
Comment #7
gallegosj CreditAttribution: gallegosj commentedUnderstood. I won't be able to debug it myself, but I don't mind waiting. I'll try setting some pre-selected defaults in the filter as a temporary fix...or just hiding the error message on the theme side perhaps.
Comment #8
Wim LeersThen you can call http://api.drupal.org/api/function/form_get_errors/6 IIRC.
Comment #9
gallegosj CreditAttribution: gallegosj commentedUnfortunately that's over my head.
Comment #10
davidzz CreditAttribution: davidzz commentedi have the same problem... subscribing and waiting..
Comment #11
bstrange CreditAttribution: bstrange commentedSubscribing.
With fastsearch stuck in D5 and the taxonomy search patch being submitted to core for D8, HS becomes one of the best solutions for custom searches in Views.
When leaving the filter as 'optional', aside from adding to the options as reported in #2, it also lists every node until an 'optional filter option is chosen. If optional is unticked, and choosing a level out of the herachy is required, it creates a very nice HS search box that can be implemented anywhere on a block or in a panel, and does not list any unfiltered node results prior to choosing the hierachy.
Unfortunately, the warnings make it 'scary' for users and the additional warnings generated for each level of sub category would become extremely annoying in deep trees. Between that and the fact that it turns the text red in the HS drop boxes, making users think they are not supposed to be choosing that text, it becomes quite useless to make the HS filter required; however, that basically kills a very nice search refinement feature of HS.
As you stated in #4 that Views is doing something it shouldn't do, I am going to post this in their queue as well and reference this issue here.
Comment #12
bstrange CreditAttribution: bstrange commentedPosted this issue in Views issue queue for consideration (http://drupal.org/node/809844)
Any of you guys who are following this issue here may want to subscribe to it over there and follow it there as well.
Comment #13
bstrange CreditAttribution: bstrange commentedReceived a response from Merlinofchaos over on the Views issue queue:
Which, if he is correct, puts the issue squarely back in the lap of this module; which is unfortunate due to Wim's work overload and inability to address the issue at this time.
I did think of a solution. If there were a way to set a default for the tree in "Configure filter Taxonomy: Term" the error would go away. I have tried disecting a similar module that offers defaults as a choice when setting filters; however, as I am far from a coder, I can't as of yet isolate the functionality to attempt to add it to HS.
If anyone else with any understanding can think of a way to implement a 'default category' that can be set when configuring the filter, please let me know.
Comment #14
druplicate CreditAttribution: druplicate commentedSubscribing
Checked "optional" for now, but hate the
<any>
!Comment #15
laroccadahouse CreditAttribution: laroccadahouse commentedWhere can I find a tutorial or some kind of walk-through for setting up an exposed filter using HS? I'm trying to create a custom advanced search page and can't figure out how to get the exposed taxonomy filter to use HS.
Comment #16
laroccadahouse CreditAttribution: laroccadahouse commentednevermind: Select Taxonomy: Term ID.....
Comment #17
Flow_TnT CreditAttribution: Flow_TnT commentedComment #18
Flow_TnT CreditAttribution: Flow_TnT commentedCould CSS be used to hide the error?
Comment #19
Wim LeersI asked merlin for details: http://drupal.org/node/809844#comment-3525180
Comment #20
scottrigby<Any>
option, I modified HS (patch attached). This patch shouldn't get added as-is. I considered adding a site-wide configuration, but even on the same site we may not want one HS filtered view to display<Any>
but we might want that on another view. So this could possibly be a configuration in the view, but it sounds like this would be better handled the way merlinofchaos suggests (once he has time to respond in detail about how this should be done - but... the Views issue queue currently has 1000 open issues - 10,000 issues total! I thought a few people here might want a temporary workaround).Comment #21
Wim LeersPlease review the attached patch.
Comment #22
tribe_of_dan CreditAttribution: tribe_of_dan commentedWas this meant to remove the 'Any' option... I am unclear. For me it didn't do that.
I have Views 2, the Global: Null argument didn't work for me either. :/ I think I might upgrade to Views 3.
Comment #23
tribe_of_dan CreditAttribution: tribe_of_dan commentedEDIT - duplicate post
Comment #24
chinita7 CreditAttribution: chinita7 commentedI did #20 patch and could remove Thanks @scottrigby. Anyway I was thinking option was not really necessary even for the HS I initially wanted to make optional becuase it has a blank space on the top of the drop down. So I will also keep HS optional for the time being.
I tried #21 patch but nothing changes..
Comment #25
stefan.r CreditAttribution: stefan.r commented6.x issue without activity for over 3 years, closing.
Please reopen if this is still an issue in 7.x.