How can I keep the search keyword displayed in the SXA search box after searching?
The search box redirects to another page with the search results component and a new search box. I want the keyword to be kept in the search box in the second page.
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityHow can I keep the search keyword displayed in the SXA search box after searching?
The search box redirects to another page with the search results component and a new search box. I want the keyword to be kept in the search box in the second page.
This should work for a long time. If you will take a look at component-search-box.js
you will notice that in the view initialization there is the following line:
XA.component.search.vent.on("hashChanged", this.updateSearchBoxValue.bind(this));
which is responsible for fulfilling the TextBox of a Search Box rendering with the value of q
param is such is there. And as far as I can see we didn't change that code for a long time so after being redirected you second Search Box should pick up query text.
Keep in mind that if you are using signatures than two search boxes signatures must match.