This project is read-only.

SearchBox text

Topics: Support Request
Dec 5, 2009 at 8:44 PM

Is there any way to add custom text to SearchBox? Like here on codeplex is written "Search all CodePlex projects".

Thanks!

Dec 6, 2009 at 5:44 PM

This would not be easy, could be change in code or here is a work around. Still not very easy.

See the discussion thread here on the dasBog Coplex forum: "How do you get rid of "by <author>" in titles", that will get you 90% there, just find the location for the search macro and add html text string of you choice. You will also need to  customize the search button display via css in the theme css file to hid the default Search Text.

To remove the current button serach you can work with this sample CSS here.

/*################################################*/
/* SEARCH */
/* DasBlog Search CSS with button image - IE 5+ and FF 1.5+ */
/* DasBlog  binaries write word "Search" on button, misdirected and hidden by CSS */
/* By Tom Watts  - 03/16/07 - http://www.tomwatts.com  */
/*################################################*/

#search {
 float: right;
}
.searchContainerStyle
{
 text-align: left;
}

.searchTextBoxStyle
{
 width:150px;
 height:15px;
 font-size:10pt; 
}

.searchButtonStyle  {
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent url(button.gif) no-repeat center;
    text-align: right;
 letter-spacing: -10px;
 font-size: 1px;
 text-indent: 100cm;
 color: #8FB430;
 overflow: hidden;  
    vertical-align: bottom;
    cursor: pointer; /* hand-shaped cursor */
    cursor: hand; /* IE 5.x */
}

 

 

Dec 6, 2009 at 6:43 PM

Hello Tom!

Thanks for your reply! You misunderstand me. I don't want to change search button (I'm satisfied with it :) ), but add a text to search textbox that will disappear when user sets cursor to this textbox. I assume that it can be done through sorce code?

thanks!

Dec 6, 2009 at 11:44 PM

OK then try this:

This is a hack of the existing install dasblog search code. Find the file "Search.ascx" in your source site source code. It should be in your site root.

Change the code to this: (new code in red)

+++++++++++++++++++++++++++++++++++++

<%@ Control Language="c#" AutoEventWireup="True" Codebehind="Search.ascx.cs" Inherits="newtelligence.DasBlog.Web.Search" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<script type="text/javascript">
<!--
function doSearch(searchString)
{
 // Trim string.
 searchString = searchString.replace(/^\s+|\s+$/g, "");
 if (searchString.length > 0)
 {
  location.href = "<%# requestPage.SiteConfig.Root %>SearchView.aspx?q=" + encodeURIComponent(searchString);
 }

 return false;
}
-->
</script>
<script type="text/javascript">
<!--
function clearDefault(el) {
if (el.defaultValue==el.value) el.value = ""
}
// -->
</script>

<div>
 <input id="searchString" value="Search here"  ONFOCUS="clearDefault(this)" onkeypress="javascript:if (event.keyCode == 13) { doSearch(searchString.value); return false; }" type="text" />
 <input id="searchButton" runat="server" type="button" value='<%# resmgr.GetString("text_search") %>' name='<%# resmgr.GetString("text_search") %>' onclick="doSearch(searchString.value);" />
</div>

+++++++++++++++++++

Remember this is a hack, new versions of dasblog may or may not include something like this.

Works for me, your milage may vary, if it kills your cat "as Scott says, don't call me!

Tom

Dec 7, 2009 at 9:09 AM

Hello Tom!

This works pretty well. I will keep in mind your warning. Does your words mean that DasBlog will have newer versions?

Thanks for you help! I appreciate it!