Primo VE Search Widgets

Primo VE can be added to websites through a simple html form and short bit of JavaScript. More information can be found at Primo VE Customization - Best Practices.

Basic Code

JavaScript

<script type="text/javascript">
     function searchPrimo() {
          document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " ");
          document.forms["searchForm"].submit();
     }
</script>
                

HTML

<form id="simple" name="searchForm" method="get" target="_self" action="https://<host_name>/discovery/search" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo()">
     <!-- Customizable Parameters -->
     <input type="hidden" name="vid" value="<inst_code:view_code>">
     <input type="hidden" name="tab" value="<tab_code>">
     <input type="hidden" name="search_scope" value="<scope_name>">
     <input type="hidden" name="mode" value="basic">
     <!-- Fixed parameters -->
     <input type="hidden" name="displayMode" value="full">
     <input type="hidden" name="bulkSize" value="10">
     <input type="hidden" name="highlight" value="true">
     <input type="hidden" name="dum" value="true">
     <input type="hidden" name="query" id="primoQuery">
     <input type="hidden" name="displayField" value="all">
     <!-- Enable this if "Expand My Results" is enabled by default in Views Wizard -->
     <input type="hidden" name="pcAvailabiltyMode" value="true">
     <input type="text" id="primoQueryTemp" value="" size="35">
     <!-- Search Button -->
     <input id="go" title="Search" onclick="searchPrimo()" type="button" value="Search" alt="Search">
</form>
            

Example 1: Minneapolis College Default Search Widget

HTML

To modify the basic code for Minneapolis College, we do the following:

  • Insert the host_name: mnpals-mct.primo.exlibrisgroup.com
  • Insert the inst_code:view_code: 01MNPALS_MCT:MCT
  • Insert the tab_code: Physical_library_slot
  • Insert the scope_name: Physical_library_scope
<form id="simple" name="searchForm" method="get" target="_self" action="https://mnpals-mct.primo.exlibrisgroup.com/discovery/search" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo()">
     <!-- Customizable Parameters -->
     <input type="hidden" name="vid" value="01MNPALS_MCT:MCT">
     <input type="hidden" name="tab" value="Physical_library_slot">
     <input type="hidden" name="search_scope" value="Physical_library_scope">
     <input type="hidden" name="mode" value="basic">
     <!-- Fixed parameters -->
     <input type="hidden" name="displayMode" value="full">
     <input type="hidden" name="bulkSize" value="10">
     <input type="hidden" name="highlight" value="true">
     <input type="hidden" name="dum" value="true">
     <input type="hidden" name="query" id="primoQuery">
     <input type="hidden" name="displayField" value="all">
     <!-- Enable this if "Expand My Results" is enabled by default in Views Wizard -->
     <input type="hidden" name="pcAvailabiltyMode" value="true">
     <input type="text" id="primoQueryTemp" value="" size="35">
     <!-- Search Button -->
     <input id="go" title="Search" onclick="searchPrimo()" type="button" value="Search" alt="Search">
</form>
            

Default Search Widget

Source for Code Values

This is where you can find the different values for the input options in the search form.

Primo url

The value for host_name and inst_code:view_code can be found in your Primo url.

Example url

https://mnpals-mct.primo.exlibrisgroup.com/discovery/search?vid=01MNPALS_MCT:MCT&sortby=rank

host_name

mnpals-mct.primo.exlibrisgroup.com

inst_code:view_code

01MNPALS_MCT:MCT

Alma Configuration

The value for tab_code & scope_name can be found in Alma Configuration > Discovery > Configure Views > Edit > Search Profile Slots.

tab_code

values listed under the Code column

scope_name

values listed under the Search Profiles column