How do I output search terms in results page?
Sorry if I'm being thick, but how do I output the search terms (from custom fields) on the Results page?
My search form:
{exp:low_search:form result_page="clients/search-results" channel="clients"}
<input type="text" name="search:client-firstname" value="" />
{/exp:low_search:form}
My results page:
{exp:low_search:results query="{segment_3}"}
{low_search_client-firstname}
{/exp:low_search:results}
Replies
Low 15 Nov 2019 19:34
This page in the docs should help you with that.
IC360 19 Nov 2019 07:49
Hi Low,
I have looked at that Docs page, and I think I have coded it correctly, but please correct me. I need to display the searched values in the search form again on the Results page:
{exp:low_search:form channel="clients" result_page="clients/search-results"}
<input type="text" name="search:client-firstname" value="{low_search_client-firstname}" placeholder="First name" />
{/exp:low_search:form}
At the moment, the search itself works fine, but the above input field only displays the placeholder text.
Low 19 Nov 2019 07:53
Okay, so the rule is: to output
param_name
use variable{low_search_param_name}
.If you apply this to
search:client-firstname
, then use the variable{low_search_search:client-firstname}
.Also, make sure the Form tag has a query="" param, like the Results tag, so it knows what query was submitted.
IC360 20 Nov 2019 09:54
All sorted. :-)
Here's my solution for a Search form, which is also displayed on the Search Results page. The form fields show the current Search terms, or the Placeholder text if that field isn't used.
There is also a Relationship field included, called 'projects'.
Thanks for your help.