Gravatar for

Question by Arun Sharma, Jul 11, 2017 11:34 AM

how can call search page on enter instead of search icon click?

Hi Team,

I am using Sitecore 8.2 (MVC). I am using Coveo SearchBoxView for search box,

but iwant to change its default behaviour.

lkie its worr when we click on search icon then it's take user to search landing page but instaead of click on search icon i want that behaviour on enter

1 Reply
Gravatar for

Answer by Sébastien Belzile, Jul 11, 2017 11:45 AM

This should work out of the box. There is an option on the component to remove the button.

Unfortunately, the Coveo for Sitecore component does not display this property. You will have to add it manually. To do so, follow these steps for the Coveo Searchbox (replace Coveo Search by Coveo Searchbox).

Gravatar for

Comment by Arun Sharma, Jul 11, 2017 12:17 PM

Thanks this property hide the search icon but as i asked in question I am not able to navigate search landing page on press Enter.

Gravatar for

Comment by anastasiyar29, Dec 19, 2017 6:01 PM

@François Lachance-Guillemette, @Jean-François L'Heureux

Hello! If there any follow up on this issue from July? I understand that the enter button is supposed to work out of the box, but it does not.

In CoveoForSitecore.js, there is this piece of relevant code:

// The enter button stops working when calling "queryController.createQueryBuilder(options);" in the populateOmnibox event.
// This ugly workaround fixes the enter button.
OmniboxResultList.prototype.bindEnterToSearchButton = function () {
            var queryBoxes = document.querySelectorAll(".CoveoSearchbox");
  , function (queryBox) {
                return {
                    input: queryBox.querySelector("input"),
                    button: queryBox.querySelector(".CoveoSearchButton")
            }).filter(function (queryBoxElements) {
                return queryBoxElements.button !== null && queryBoxElements.input !== null;
            }).forEach(function (queryBoxElements) {
                queryBoxElements.input.addEventListener("keyup", function (event) {
                    if (event.keyCode === 13) {

I have a breakpoint inside the keyup event handler - the breakpoint is hit when I type regular characters, but it's not hit when I hit enter.

Thank you,


Ask a question