SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Put your solution as an answer and mark it as the accepted answer. – Mike Jun 18 '13 at 18:12
Ok @Mike done !!! – Tito Jun 18 '13 at 18:15
up vote 0 down vote accepted

The problem was:

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

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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