I am trying to search using the default search control from sharepoint.

<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">  
    <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>    

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")
        if (frm !=null)
            var searchText=frm.elements["SearchString"].value; //ERROR IN HERE
            var searchScope=frm.elements["SearchScope"];
            if (searchScope !=null)
                var searchScopeUrl=searchScope.value;
                if (searchScopeUrl)

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.


Where k => query and u=> scope.

If somebody knows a workaround or how to solve this problem, please let me know.

  • Ok @Mike done !!! – Tito Jun 18 '13 at 18:15

The problem was:

 <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">  

was not inside a form. I just added a form and it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.