+ Start a Discussion
HalcyonandonHalcyonandon 

Customer Portal Search component

Is it possible to take the search component from the sidebar and utilize it in my own customer portal design as I see fit?  I need to disable the sidebar for the purpose of our customer portal, while retaining the search functionality....

Additionally,  currently customer portal searches and finds the data in the custom objects, but do I have any control over how these custom objects are displayed when a user searches for them?  By default when a user searches and finds custom object data they view the object and not the data directly.

So I guess the best way to phrase my question is... How does one create a custom search component in the customer portal.
HalcyonandonHalcyonandon
Found the answer to this, figured I would share.  I used firebug to inspect the search component element, copied the html, stripped out the styles and elements we didnt need, worked just fine...

Code:
<div>
<form onsubmit="if (window.ffInAlert) { return false; }if(this.sbstr){this.sbstr.blur();}"
name="sbsearch" method="get" id="sbsearch"
action="/search/SearchResults">
<input type="hidden" value="1" id="searchType" name="searchType" />
<div>
<div>
<input type="text" value="" title="Search" size="27" name="sbstr"
maxlength="80" id="sbstr" />
<input type="submit" title="Go!" name="search" class="btn"
value=" Go! " />
</div>
<div>
<a onclick="document.getElementById('sbsearch').
action='/search/AdvancedSearch';document.getElementById('sbsearch').submit();
return false;" href="/search/AdvancedSearch">Advanced Search...</a> </div> </div> </form> </div>

 

dchasmandchasman
We do have componentizing things like this in our plans for the next few releases. With that in mind you might want to encapsulate your workaround using a trivial custom component like this (e.g. if you named the component portalSearch):
<apex:component>
<div>
<form onsubmit="if (window.ffInAlert) { return false; }if(this.sbstr){this.sbstr.blur();}"
name="sbsearch" method="get" id="sbsearch"
action="/search/SearchResults">
<input type="hidden" value="1" id="searchType" name="searchType" />
<div>
<div>
<input type="text" value="" title="Search" size="27" name="sbstr"
maxlength="80" id="sbstr" />
<input type="submit" title="Go!" name="search" class="btn"
value=" Go! " />
</div>
<div>
<a onclick="document.getElementById('sbsearch').
action='/search/AdvancedSearch';document.getElementById('sbsearch').submit();
return false;"
href="/search/AdvancedSearch">Advanced Search...</a>
</div>
</div>
</form>
</div>
<apex:component>


then you can just reference this in your VF page

<apex:page>
...
<c:portalsearch/>
...
<apex:page>




Message Edited by dchasman on 04-30-2008 11:24 AM
HalcyonandonHalcyonandon
Thanks, that makes my header file much cleaner.

Now if I could only customize the search results page so it displays the results how i want...