Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

QueryTextBox initialization - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
DMacy
#1 Posted : Wednesday, December 10, 2014 11:27:34 AM
Rank: Advanced Member

Groups: Registered

Joined: 9/1/2010
Posts: 136
I have the following SearchBox:

<keyoti:SearchBox ID="sbxProdSearch" runat="server" AutoCompleteQuery="True" AutoCompleteQueryFailSilent="True" AutoCompleteQueryMaxSuggestions="5"
AutoCompleteQueryRunSearchOnSelect="True" AutoCompleteQueryShowNumberOfResults="True" OnSearch="sbxProdSearch_OnSearch" RememberQuery="True">
<QueryTextBox ID="qtbProdSearch" runat="server" CssClass="text-box init" type="text" />
<SearchButton ID="sbProdSearch" runat="server" CssClass="go-button" type="button" Value="Go" />
</keyoti:SearchBox>

I also have the following script defined on that ASPX page:

<script type="text/javascript">
function clearTextBox(me) {
me.className = me.className.replace(" init", "");
me.value = "";
return true;
}
</script>

In the code-behind for that page, I have:

qtbProdSearch.Attributes.Add("onFocus", "return clearTextBox(this);")

The intent is for the initial text ("Search products") to be gray (the "init" CSS class) and for the text to be cleared and the color restored to black when the user clicks in the text box. It's not happening. I have used this same technique successfully with an HTML textbox. Is there another way to do it with the Keyoti QueryTextBox?
Dan
#2 Posted : Wednesday, December 10, 2014 12:27:44 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 10/20/2004
Posts: 456
Hi Dan,

You should be able to use this in the code-behind;

SearchBox1.QueryTextBox.Attributes.Add("onclick", "this.value=''");

Let me know how that goes.

Dan
Dan Wright
DMacy
#3 Posted : Wednesday, December 10, 2014 12:43:08 PM
Rank: Advanced Member

Groups: Registered

Joined: 9/1/2010
Posts: 136
That was what I needed. Thanks!

Dan
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.