4

I need to hide global search under Manage Communities --> Edit --> Click on Tabs and Pages -->Select standard salesforce tabs --> select chatter tab..When i did this and when i change from Internal to Communities on the header I see the global search box

I think If I hide it for chatter tab it will hide under above specified location.

4 Answers 4

3

Try to use the native javascript, it is easier in this case. And then just hide the element with a class name headerSearchContainer:

<script>
    window.onload = function(){
        document.getElementsByClassName('headerSearchContainer')[0].style.display = 'none';
    };
</script>
8
  • Except, don't hook into window.onload. Just use addEventListener/attachEvent (for old IE) and use that instead. You may accidentally conflict with a salesforce.com internal library if you use window.onload.
    – sfdcfox
    Commented Dec 9, 2013 at 20:46
  • @sfdcfox I have had cases (SFDC of course) where jQuery's "ready" function has not worked (conflict with prototype?), but "window.onload" worked just fine. So i prefer this now :) But nice hint about "addEventListener", almost forgot about it! Commented Dec 9, 2013 at 20:55
  • @mast0r I have added your script to visualforce but still not working
    – sfdc
    Commented Dec 9, 2013 at 21:06
  • @sf.dev Strange, for me works well... Try to find out the ID of the global search element on you page with a firebug etc (right click on the search field). Commented Dec 9, 2013 at 21:11
  • 1
    @amatorVitae You can use jQuery for sure, but for this simple case i think it not necessary to load whole library only for hiding one element. Commented Dec 9, 2013 at 21:38
3

I have added blank html file to Documents folder and then updated the header of community under Manage Communities --> Edit Community Name --> Branding -->Header (Upload the html file from document folder) and this has removed the global search from chatter tab

<html lang="en">
<head>
</head>
<body>
</body>
</html>
1
  • This is perfect! Commented Aug 18, 2017 at 7:28
1

Go to Customize > Home > Home Page Components and create a new home page component. Give it some name and make the Type as HTML Area and hit next.

Make the component position Narrow (left) column. And paste this in the huge text area below.

<script type="text/javascript">
  document.getElementsByTagName('nav')[0].style.border="1px solid white";
  document.getElementsByClassName('left')[0].style.visibility = 'hidden';
  document.getElementById('phHeaderLogoImage').style.visibility = 'visible';
  document.getElementsByClassName('right')[0].style.visibility = 'hidden';
  document.getElementsByClassName('multiforce')[0].style.visibility = 'visible';
  document.getElementsByTagName('nav')[0].style.borderTopLeftRadius = '.5em';
  document.getElementsByTagName('nav')[0].style.borderTopRightRadius = '.5em';
  document.getElementsByTagName('nav')[0].style.MozBorderRadiusTopleft = '.5em';
  document.getElementsByTagName('nav')[0].style.MozBorderRadiusTopright = '.5em';
  document.getElementsByTagName('nav')[0].style.WebkitBorderTopLeftRadius = '.5em';
  document.getElementsByTagName('nav')[0].style.WebkitBorderTopRightRadius = '.5em';
</script>

<style>

  #phSearchButton {
     display: none !important;
  }

  #phSearchInput_autoCompleteBoxId .autoCompleteHoverRow {
     display: none !important;
  }

  #phSearchInput_autoCompleteBoxId .footerRow {
     display: none !important;
  }

  #phSearchInput {
     display: none !important;
  }

  </style>

Apply that custom component to all the styling your org is using.

Hopefully it should help.

4
  • 1
    Oh I forgot to mention, this method will hide the global search in all the pages, visualforce and standard salesforce pages. Commented Dec 9, 2013 at 21:02
  • @Neeraj.I need to hide it only on one visualforce page
    – sfdc
    Commented Dec 9, 2013 at 21:03
  • Do you want the header in your visualforce page? If not then you can do showHeader="false", if you want your header then try inserting the style I wrote above in the <style> of your vf page. Commented Dec 9, 2013 at 21:26
  • Requirement got updated.I need to hide it on standard chatter page not elsewhere
    – sfdc
    Commented Dec 9, 2013 at 22:13
1

You can always override the Communities header with your own HTML rather than using the standard HTML, which includes global search. Here is the HTML for adding custom global search box:

<form action="/<community name>/search/SmartSearch" method="get">
    <input id="phSearchInput" type="text" name="str"/>
    <input type="submit" value="Search"/>
</form>
2
  • above html is used for adding the global search box to header But I want to remove search box.I am getting search box on the communities (I have added selected tab as chatter under Manage Communities --> Edit --> Click on Tabs and Pages -->Select standard salesforce tabs --> select chatter tab..When i did this and when i change from Internal to Communities on the header I see the global search box
    – sfdc
    Commented Dec 9, 2013 at 23:12
  • What I'm saying is that if you add your own HTML to the header, the global search box will disappear. You may want to add it back selectively, hence the HTML sample above.
    – greenstork
    Commented Dec 10, 2013 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .