Searchbox Error
I am getting a weird search box error when trying to search.
I created a blank page (Start from scratch) and still get this error. (MVC)
Hello Decker,
I just wanted to add this answer to your forum post in case someone else runs into this issue as I see it was answered in your support ticket you filed.
This issue occurs due to a Javascript error in the Digital Experience Cloud module, disabling this module will fix this issue. Currently this is the only workaround available and the issue is being investigated by our development engineers.
Regards,
Nick Rajotte
Telerik
I am running into this as well. We are using DEC and can't disable it.
The SearchBox runs fine in preview but I get that "sentence.object" error when I navigate to the page itself.
All I have is a blank page with the SearchBox widget on it.
Hey Decker,
Have you guys found a workaround for this? We are using DEC and can't shut it off.
Hi Matthew. I can suggest one solution for you. If you are using Feather.
1) Place attached search-box-without-dec.js somewhere
(function ($) $(document).ready(function () var searchBoxIdFields = $('[data-sf-role="searchTextBoxId"]'); for (var i = 0; i < searchBoxIdFields.length; i++) var searchBoxIdField = $(searchBoxIdFields[i]); var controlServerData = resultsUrl: searchBoxIdField.siblings('[data-sf-role="resultsUrl"]').first().val(), indexCatalogue: searchBoxIdField.siblings('[data-sf-role="indexCatalogue"]').first().val(), wordsMode: searchBoxIdField.siblings('[data-sf-role="wordsMode"]').first().val(), disableSuggestions: $.parseJSON(searchBoxIdField.siblings('[data-sf-role="disableSuggestions"]').first().val()), minSuggestionLength: searchBoxIdField.siblings('[data-sf-role="minSuggestionLength"]').first().val(), suggestionFields: searchBoxIdField.siblings('[data-sf-role="suggestionFields"]').first().val(), language: searchBoxIdField.siblings('[data-sf-role="language"]').first().val(), suggestionsRoute: searchBoxIdField.siblings('[data-sf-role="suggestionsRoute"]').first().val(), searchTextBoxSelector: searchBoxIdField.val(), searchButtonSelector: searchBoxIdField.siblings('[data-sf-role="searchButtonId"]').first().val() ; featherSearchBoxWidget(controlServerData); function featherSearchBoxWidget(serverData) var searchTextBox = $(serverData.searchTextBoxSelector), searchButton = $(serverData.searchButtonSelector); searchButton.click(navigateToResults); searchTextBox.keypress(keypressHandler); /* Initialization */ if (!serverData.disableSuggestions) searchTextBox.keyup(keyupHandler); try searchTextBox.autocomplete( source: [], messages: noResults: '', results: function () , select: function (event, ui) searchTextBox.val(ui.item.value); navigateToResults(event); , ).autocomplete("widget").addClass("sf-autocomplete"); catch (e) // Fixes jQuery bug, causing IE7 to throw error "script3 member not found". // The try/catch can be removed when the bug is fixed. /* Event handlers */ function keypressHandler(e) if (!e) e = window.event; var keyCode = null; if (e.keyCode) keyCode = e.keyCode; else keyCode = e.charCode; if (keyCode == 13) navigateToResults(e); function suggestionsSuccessHandler(result, args) var dataSource = result.Suggestions; searchTextBox.autocomplete('option', 'source', dataSource); searchTextBox.autocomplete("search", searchTextBox.val().trim()); function keyupHandler(e) if (e.keyCode != 38 && // up arrow e.keyCode != 40 && // down arrow e.keyCode != 27) // esc // When the auto complete menu is shown, only this event is detected if (e.keyCode == 13) // when enter is pressed navigateToResults(e); var request = ; var searchText = searchTextBox.val().trim(); if (searchText.length >= serverData.minSuggestionLength) request.IndexName = serverData.indexCatalogue; request.SuggestionFields = serverData.suggestionFields; request.Text = searchText; request.Language = serverData.language; $.ajax( type: "GET", url: serverData.suggestionsRoute, dataType: 'json', data: request, success: suggestionsSuccessHandler ); /* Helper methods */ function navigateToResults(e) if (!e) e = window.event; if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; var query = searchTextBox.val(); if (query && query.trim() && serverData.indexCatalogue) window.location = getLocation(); function getLocation() var query = searchTextBox.val().trim(); var separator = (serverData.resultsUrl.indexOf("?") == -1) ? "?" : "&"; var catalogueParam = separator + "indexCatalogue=" + encodeURIComponent(serverData.indexCatalogue), searchQueryParam = "&searchQuery=" + encodeURIComponent(query), wordsModeParam = "&wordsMode=" + serverData.wordsMode; var url = serverData.resultsUrl + catalogueParam + searchQueryParam + wordsModeParam; return url; function sendSentence() if (window.DataIntelligenceSubmitScript) DataIntelligenceSubmitScript._client.sentenceClient.writeSentence( predicate: "Search for", object: searchTextBox.val(), objectMetadata: [ 'K': 'PageUrl', 'V': location.href ] ); );(jQuery));2) Override searchbox view. Put SearchBox.cshtml to ResourcePackages\YOUR PACKAGE\MVC\Views\SearchBox\SearchBox.cshtml
@model Telerik.Sitefinity.Frontend.Search.Mvc.Models.ISearchBoxModel@using Telerik.Sitefinity.Services;@using Telerik.Sitefinity.Modules.Pages;@using Telerik.Sitefinity.Frontend.Mvc.Helpers;@ var searchTextBoxId = Guid.NewGuid(); var searchButtonId = Guid.NewGuid(); @(!String.IsNullOrEmpty(Model.CssClass) ? Html.Raw(String.Format("<div class=\"0 form-inline\">", Model.CssClass)) : Html.Raw("<div class=\"form-inline\">")) <div class="form-group"> <input type="search" title="@Html.Resource("SearchInput")" placeholder="@Model.BackgroundHint" id="@Html.Raw(searchTextBoxId)" class="form-control" value="@Html.Raw(ViewBag.SearchQuery)"/> </div> <button type="button" class="btn btn-primary" id="@Html.Raw(searchButtonId)">@Html.Resource("SearchLabel")</button> <input type="hidden" data-sf-role="resultsUrl" value="@Html.Raw(Model.ResultsUrl)" /> <input type="hidden" data-sf-role="indexCatalogue" value="@Html.Raw(Model.IndexCatalogue)" /> <input type="hidden" data-sf-role="wordsMode" value="@Html.Raw(Model.WordsMode.ToString())" /> <input type="hidden" data-sf-role="disableSuggestions" value='@(Model.DisableSuggestions ? Html.Raw("true") : Html.Raw("false"))' /> <input type="hidden" data-sf-role="minSuggestionLength" value="@Html.Raw(Model.MinSuggestionLength)" /> <input type="hidden" data-sf-role="suggestionFields" value="@Html.Raw(Model.SuggestionFields)" /> <input type="hidden" data-sf-role="language" value="@Html.Raw(Model.Language)" /> <input type="hidden" data-sf-role="suggestionsRoute" value="@Html.Raw(Model.SuggestionsRoute)" /> <input type="hidden" data-sf-role="searchTextBoxId" value='@("#" + searchTextBoxId.ToString())' /> <input type="hidden" data-sf-role="searchButtonId" value='@("#" + searchButtonId.ToString())' /></div>@* The inline editing functionality is loading jQuery too. *@@Html.Script(ScriptRef.JQuery, "top", true)@Html.Script(ScriptRef.JQueryUI, "top", true)@Html.Script("Mvc/Scripts/SearchBox/search-box-without-dec.js", "bottom")3) Fix path to search-box-without-dec.js inside this view