I am trying to search using the default search control from sharepoint.
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>
But when using the search button it calls the Js function defined in core.js
as bellow:
function SubmitSearchRedirect(strUrl)
{
var frm=document.forms["frmSiteSearch"];
if (frm==null)
{
if (typeof(MSOWebPartPageFormName) !="undefined")
frm=document.forms[MSOWebPartPageFormName];
}
if (frm !=null)
{
var searchText=frm.elements["SearchString"].value; //ERROR IN HERE
strUrl=strUrl+"?k="+escapeProperly(searchText);
var searchScope=frm.elements["SearchScope"];
if (searchScope !=null)
{
var searchScopeUrl=searchScope.value;
if (searchScopeUrl)
{
strUrl=strUrl+"&u="+escapeProperly(searchScopeUrl);
}
}
frm.action=strUrl;
frm.submit();
}
}
It passes the 3 first ifs and generates an error on the line:
var searchText=frm.elements["SearchString"].value;
with the error message:
TypeError: frm.elements.SearchString is undefined
This method is concatenating the queryString for the url bellow (if I access the method it works correctly), is a simple POST.
http://www.siteName/_layouts/searchresults.aspx?k=SEARCHINHERE&u=SCOPEADDRESS
Where k => query and u=> scope.
If somebody knows a workaround or how to solve this problem, please let me know.