1

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.

  • Can you please add more detail around this? How have you configured search, is it going to a new results page? which search box do you need the keyword being kept in? – Richard Seal Jul 11 '18 at 13:18
  • Please see the quality guidelines on What makes a good post – Richard Seal Jul 11 '18 at 13:25
  • Beside two above comments - the search query stays in the Search Box rendering after either search button or return are pressed. – Dawid Rutkowski Jul 11 '18 at 13:44
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.