Custom Search Throwing An Error

Topics: Controls, Themes
Sep 13, 2010 at 4:31 PM

Hello all!

I have added a custom search box (by custom i mean my own button and textbox images) into the header of my blog. I have the layout the way i want it but i have an error when i try and search. I will try and be as descriptive as i can with the error.  When i type something into MY search box and click search it searches for the text that is set to the search widget (the text you can set under the control tab in admin) i know this because within that tab i have the text "Search" and within my search box i have the text "search here". What am i doing wrong? How can i get my search to accept the input value and search for that.

My Code:

<div id="topsearch">
        <input id="searchbar" onblur="if (this.value == '') {this.value = 'Search here...';}" onfocus="if (this.value == 'Search here...') {this.value = '';}" value="Search here..." id="searchfield" class="keyword" type="text" onkeypress="if(event.keyCode==13) return BlogEngine.search('/');" />
         <input id="searchsubmit" type="button" onkeypress="BlogEngine.search('/');" onclick="BlogEngine.search('/'); "/>
<br /><input style="display:none;" type="checkbox" id="searchcomments"  />       
        </div>

 

I have swapped out the "onclick=BlogEngine.search('/');"/> with "onclick=BlogEngine.search('this.value');"/> and that gives me an error page.

 

Thanks for any help!

Coordinator
Sep 13, 2010 at 4:56 PM

Here is how to get custom search working. Search function does not take search term as a parameter, "/" indicates that your site runs in the root and "" (empty") that it is in sub-folder. Search term is whatever in the textbox with id "searhfield".

Sep 13, 2010 at 10:14 PM

Worked Great! Thanks!