keep the string of smart search box in the master page on redirect

hassan kalach asked on October 13, 2017 08:45

Hi guys, so I have a smart search box up in my master page, and as mentioned in the documentations, when submitting the search query the website will redirect to a page that contains a smart search results web part. My problem is that I want to keep the values inside the smart search box even after redirection. Is there a way to preserve the data (or the string)inside a textbox (within a master page) from one page to another?

Correct Answer

Rui Wang answered on October 13, 2017 19:04

hassan, in the "watermark text" property of the search box web part, click on the black triangle and enter this macro in the edit value box.

{% QueryString.searchtext != null ? QueryString.searchtext : "Search" #%}

1 votesVote for this answer Unmark Correct answer

Recent Answers


Matt Nield answered on October 13, 2017 10:40 (last edited on October 13, 2017 10:40)

Depending on how your search works, you can use some JavaScript to set the value of the text box to the QueryString value. On the Dancing Goat site, the key is searchtext for example.

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on October 13, 2017 12:34

hello, I am sorry your answer was not really helpful since I am new to kentico and javascript both so I need a little more explanation and examples. also please note that I dont have the dancing goat site so I dont have access to its code. If you may add more explanations a would be grateful.

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on October 17, 2017 15:31

@rui-wang exactly what i needed. thank you.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.