1

On Sharepoint Online, on the Search Center main page, my users require a secondary custom search form like this:

enter image description here

I added a Script Editor Web Part, entered a table, form and fields as shown above, but don't know how to specify the form action to call the same results page as the main Search Box, HTML code follows:

<form name='DocNumForm' action='https://tenant.sharepoint.com/sites/SEDASearch/Pages/results.aspx?k=' method='get' target='_blank'>
<table border='0' cellspacing='0' cellpadding='10'>
    <tr>
        <td><font size='-1'>Prefix:</font><br><input type='text' name='Prefix' size='5' maxlength='2' value=''></td>
        <td><font size='-1'>Series:</font><br><input type='text' name='Series' size='5' maxlength='3' value=''></td>
        <td><font size='-1'>Base:</font><br><input type='text' name='Base' size='5' maxlength='3' value=''></td>
        <td><font size='-1'>Suffix:</font><br><input type='text' name='Suffix' size='5' maxlength='2' value=''></td>
        <td><font size='-1'>Revision:</font><br><input type='text' name='Revision' size='5' maxlength='2' value=''></td>
        <td><font size='-1'>&nbsp;</font><br><input type='submit' name='submit' value='Search'></td>
    </tr>
</table>
</form>

How do I do this? What should I use for the action value?

  • Are they all managed properties? (prefix, series, base, suffix, revision) or it's just one column? – YogaPanda Nov 8 '16 at 20:46
  • Thx @YogaPanda, Yes, they are all managed properties... – Barry Prentiss Nov 8 '16 at 22:08
  • Then it will be easy to use advanced search webpart, writing an answer and will post it later, – YogaPanda Nov 8 '16 at 22:09
0

If you want to fire search via javascript input:

function fireSearch() { 
    var link = "";
    $('#submitBtn').click(function(event) {     
        event.preventDefault();     
        var queryString = $('#input').val();     
        var location = "/_layouts/15/osssearchresults.aspx?&k=" + queryString; 
        link = location;    
        $('#input').attr("value", '');  
        window.location.href = link;    
        return;
    });
}

fireSearch();​

Reference from here: https://stackoverflow.com/questions/34943597/window-location-replace-is-not-working-in-my-sharepoint-site

If you want to do it with no code solution, you can use advanced search. Open advanced search page, modify the webpart, export the webpart, edit your search page and upload it. Let me know if step-by-step screenshots will be helpful.

enter image description here enter image description here

  • Thx Again @YogaPanda. My users require a Search Center main page form addon like the one I have prototyped above, and object to using the Advanced Search page as you have shown... Can you show me how I would implement this js function from the form tag in my HTML example? I'd be much obliged : ) – Barry Prentiss Nov 8 '16 at 23:16

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.