getting the filter value into the Search Heading

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
yonatanlehman
Propeller Head
Posts: 51
Joined: Mon Sep 18, 2017 6:14 am

getting the filter value into the Search Heading

Post by yonatanlehman »

In the default Flare search output, it is not possible to see what filter was applied.
I can probably solve this myself in Javascript by looking for the value of the 'f' query parameter in the URL, but before I go that way I'm hoping there is a built-in solution
For example, in the SearchResults Skin I can set the UI text of the Search Heading to Showing {total_results} results for {query}

Perhaps there apart from the supported meta values {total_results} and {query} there is something like {filter}
(I did try {filter} - nope...)

Any other ideas on how to show the user which filter is active?

Thanks
jimgilliam
Propeller Head
Posts: 84
Joined: Tue Jun 04, 2013 9:49 am
Location: Arkansas, U.S.A.

Re: getting the filter value into the Search Heading

Post by jimgilliam »

In the output, Flare generates this code for selected filter. Could you use the "selected" class to grab the title value, store as a variable, and then include the variable on your custom search results page?

Code: Select all

<div class="search-filter selected" aria-haspopup="true" aria-controls="sf-content" aria-expanded="false" aria-label="Search Filter" role="button" tabindex="0" title="NewFilter"></div>
:flare:
jimgilliam
Propeller Head
Posts: 84
Joined: Tue Jun 04, 2013 9:49 am
Location: Arkansas, U.S.A.

Re: getting the filter value into the Search Heading

Post by jimgilliam »

Or, it might be easier to grab the selected value from Flare's search filter form?
:flare:
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: getting the filter value into the Search Heading

Post by NorthEast »

I'm not aware of any {filter} parameter, and there probably isn't one because it's not included in any messages.

Quite easy to get the selected filter name though:

Code: Select all

var selectedFilter = $(".search-filter.selected").attr("title");
Might be better to use that method, as getting the 'f' parameter value will presumably include "%20" instead of spaces?
jimgilliam
Propeller Head
Posts: 84
Joined: Tue Jun 04, 2013 9:49 am
Location: Arkansas, U.S.A.

Re: getting the filter value into the Search Heading

Post by jimgilliam »

Thanks! I'll be using the method you mentioned.
:flare:
Post Reply