Search This Blog

Friday, October 4, 2013

Custom Search - Sharepoint 2013

<div>
        <div id="searchContentFiles">
            <sharepoint:ajaxdelta id="DeltaSearch" blockelement="true" runat="server">
             <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />
             </sharepoint:ajaxdelta>
        </div>
        <div id="peopleSearch">
            <input type="text" id="command" placeholder="people skills&hellip;" />
        </div>
        <div id="locationsSearch">
            <input type="text" id="commandz" placeholder="location&hellip;" />
        </div>
</div>
-----------------------------------------------------------------------------------------
    <script type="text/javascript">
        $(document).ready(function () {
            $('#command').keydown(function (e) {

                if (e.which === 13) {
                    event.preventDefault();
                    var value = $('#command').val();
                    if (value != "") {
                        window.location = document.location.href = "/Search/Pages/peopleresults.aspx?k=" + value;
                    } else {
                        window.location.href = "/sites/Test/";
                    }

                    return false;
                }
            });
            $('#commandz').keydown(function (e) {

                if (e.which === 13) {
                    event.preventDefault();
                    var Locvalue = $('#commandz').val();
                    if (Locvalue != "") {

                        var FilterStar = "*" + Locvalue + "*";
                        window.location = document.location.href = "/sites/test/lotion/NewsForm?FilterName=Title&FilterMultiValue=" + FilterStar;
                    } else {
                        window.location.href = "/sites/test/";
                    }

                    return false;
                }
            });

        });

    </script>

No comments:

Post a Comment