Gravatar for

Question by Simon, Jul 24, 2015 7:06 AM

Auto Suggestion on Search box not loading

Hi, the Search box on my site which is in the Header of my site's pages.

The code is:

   Coveo.$(function () {
    //if we want to remove the box
    if (!isOnSearchPage()) {
        Coveo.$('#FWDCoveoSearchBox').coveo('initSearchBox', '/Main-Search');


    setTimeout(function () {
        Coveo.$('#FWDCoveoSearchBox').find("input.CoveoQueryBox").attr("placeholder", "<%= Sitecore.Globalization.Translate.Text("Search")%>");
    }, 0);


function isOnSearchPage() {
    return $('#search').length > 0;

 <div id="FWDCoveoSearchBox"  class="CoveoSearchInterface">
        <div class="CoveoSearchBox" data-activate-omnibox="true"></div>
        <div class="CoveoTopFieldSuggestions"
            data-field="<%= Coveo.UI.SitecoreUtilities.ToCoveoFieldName("Auto Suggestion Keyword") %>"
            data-header-title="Suggested Queries"></div>

The Search Box works and Auto Suggestion comes up when i am in the Search page. But when i am in the Home page or anything else the Auto Suggestion does not work.

Gravatar for

Comment by Martin Laporte, Jul 24, 2015 8:13 AM

try adding debugger before calling initSearchBox and then loading with dev tools opened, it's possible there is something wrong with your isOnSearchPage condition.

Gravatar for

Comment by Jean-François L'Heureux, Aug 4, 2015 5:09 PM

Is there any error in your browser console while loading the home page? Do you include the Coveo Search Resources component before this script and div tags?

1 Reply
Gravatar for

Answer by Simon, Aug 4, 2015 5:25 PM

This issue was troubleshooted by Coveo Support and the client did manage to have the desired behavior. The solution has been documented here:


Ask a question