Search Page not Searching?

Topics: ASP.NET 2.0, Controls, Themes
Dec 5, 2007 at 11:48 PM
While creating a custom template that has a search box available up at the top right hand corner all the time. I noticed that after a search, the search box that appears in the search page does not work when "Enable comment search" is unchecked. So digging further I found that the javascript is looking for
"<input type="checkbox" name="comment" id="comment" />"
and if that is not there the script errors and thus cripples the search box. So to fix this with a quick little hack I tacked on an else statement to the if statement that starts on line 11:

<% if (BlogSettings.Instance.EnableCommentSearch){ %>
<input type="checkbox" name="comment" id="comment" /><label for="comment"><%=BlogSettings.Instance.SearchCommentLabelText %></label>
<%}

And added:

else { %>
<input type="checkbox" name="comment" id="comment" style="display: none;" />
<% } %>