• Broads
  • 51.8% (Neutral)
  • YAF Forumling Topic Starter
15 years ago

Just thought I'd post a fix for a small issue encountered when using the forums search functionality.

The problem resolves around hitting the return key after entering a search term.

If there are no other buttons on the page then this is fine, however if your forum is embeded the postback will cause the first cmd button on your page to fire. (well it did for me.)

The simeple fix is on the page_load of the forum/pages/search.ascx.cs file add an attribute to the 2 search text boxs.

            this.txtSearchStringWhat.Attributes.Add("onkeypress", "submitForm(event, '" + btnSearch.ClientID + "');");
            this.txtSearchStringFromWho.Attributes.Add("onkeypress", "submitForm(event, '" + btnSearch.ClientID + "');");

Hope this helps some people.