imagebutton in searchbox

Topics: Themes
Jul 24, 2007 at 1:17 AM
Hi all,

How can I use an image button for the regular input button in the search box?
I tried replacing type="button" with type="image" in Controls\SearchBox.cs.

It works (searches run successfully) as long as I hit "enter" while focus is on the searchfield.
But if I click the image button, it simply redirects to default.aspx, or it just doesn't work.

Any help is appreciated.

Thanks,
John
Coordinator
Jul 24, 2007 at 9:54 PM
Have you looked at the onclick javascript event?
Jul 25, 2007 at 7:40 AM
Edited Jul 25, 2007 at 9:30 AM
hmm, for some reason it's working now. I may have forgotten to rebuild.

Thanks,
John
Mar 12, 2008 at 5:13 PM
I too am having the same issue. In Controls\SearchBox.cs

I replaced:
<input type=\"button\" value=\"{0}\" id=\"searchbutton\" onclick=\"Search('{1}');\" onkeypress=\"Search('{1}');\" />", BlogSettings.Instance.SearchButtonText, Utils.RelativeWebRoot);

With:
<input type=\"image\" src=\"http://www.mysite/images/search_button.gif\" width=\"20\" height=\"20\" value=\"{0}\" id=\"searchbutton\" onclick=\"Search('{1}');\" onkeypress=\"Search('{1}');\" />", BlogSettings.Instance.SearchButtonText, Utils.RelativeWebRoot);

When I hit the "Enter" key on my keyboard it works but when I click the "image" button it redirects back to my default.aspx.

I'm a rookie so any help is mucho appreciated!