Hi All,
I am facing an issue with aem 6.3.
In http://localhost:4502/sites.html/content there is a search icon in the top right corner. If we do an empty search it works fine in local. but in production, it is giving internal server error.
Is there any way to restrict empty search in siteadmin ? Can we customize this search ?
Thanks,
Dipanjan
Hi,
You can add a condition to NOT submit form if input is empty or undefined.
To add condition, you need to update /libs/granite/ui/components/shell/clientlibs/shell/js/omnisearch.js file at line 635, where search overlay is being injected in DOM in openOmnisearch function i.e.
// we load the overlay dynamically
$.get(url, function(data) {
$("body").append(data).trigger("foundation-contentloaded");
omnisearch = document.querySelector(".granite-omnisearch-overlay");
add Check empty input value code after that
// we load the overlay dynamically
$.get(url, function(data) {
$("body").append(data).trigger("foundation-contentloaded");
//check for empty input
$(".foundation-form.granite-omnisearch-form").submit(function(e){
var inputField = $(".foundation-form.granite-omnisearch-form input.granite-omnisearch-typeahead-input");
if(inputField !== typeof undefined){
if(inputField.val()==="" || inputField.val()===undefined)
return false;
}
});
omnisearch = document.querySelector(".granite-omnisearch-overlay");
Thanks
Arun
Thanks arunp99088702 for responding.
I have a doubt here, can we create an overlay omnisearch component in our project inside /apps/../ ? Will that work for the siteadmin search ?
Views
Replies
Total Likes
Hi,
I doubt, because this is not a component , this is a clientlibs. If you create same file in /app/ folder, this would also be referred.
what you can do, you can create a copy of /libs/granite/ui/components/shell/clientlibs/shell/js/omnisearch.js file and update js.txt with new file
Thanks
Arun