Skip to content

Instantly share code, notes, and snippets.

@laurenlibrarian
Last active May 7, 2019 21:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laurenlibrarian/871cb414ea3b8e81aa723b75226ed14e to your computer and use it in GitHub Desktop.
Save laurenlibrarian/871cb414ea3b8e81aa723b75226ed14e to your computer and use it in GitHub Desktop.
<html>
<head></head>
<body>
<!--Widget Starts Here-->
<form id="simple" name="searchForm" method="get" target="_self" action="https://sbctc-shoreline.primo.exlibrisgroup.com/discovery/" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo()">
<div class="">
<input type="text" id="primoQueryTemp" style="width: 45%;">
<!--Value in the next line should be your institution-->
<input type="hidden" name="institution" value="SHORELINE">
<!--Value in the next line should be your Ex Libris code-->
<input type="hidden" name="vid" value="01STATEWA_SHORLINE:SHORELINE">
<!--Next line is for Library Catalog. ID is named primoTab and used in Javascript to pull URL-->
<input type="hidden" name="tab" id="primoTab">
<!--Next line specifies basic search instead of advanced search in Primo-->
<input type="hidden" name="mode" value="Basic">
<!--Below this line defines your drop-down options. They must be named as value equals.-->
<select name="search_scope" id="primoScope" style="width: 38%; height: 34px;">
<option value="MyInstitution">Library Catalog</option>
<option value="MyInst_and_CI">Books, Articles &amp; more</option>
<option value="CentralIndex">Online Resources</option>
<option value="Ebsco">EBSCO</option>
<option value="CourseReserves">Course Reserves</option>
</select>
<!-- 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">
<!-- Search Button. Change style= as you like for font/size/border-->
<input id="go" title="Search" onclick="searchPrimo()" type="button" value="Go" alt="Search" style="border-radius: 4px; font-family: Helvetica, Arial, sans-serif; background: linear-gradient(#2d95b7, #23748e); color: #ffffff; border: 1px solid;">
</div></form>
<!--Widget Ends Here-->
<!--Below this line is the javascript that must appear on the page where your Primo VE widget is placed. Many people argue that Javascript should be the last thing to run on a page and is best placed right before the closing body tag-->
<script type="text/javascript">
function searchPrimo() {
document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " ");
var dropdownValue = document.getElementById("primoScope").value;
var tabValue;
switch (dropdownValue){
case "MyInstitution":
tabValue = "LibraryCatalog";
break;
case "MyInst_and_CI":
tabValue = "Everything";
break;
default:
tabValue = dropdownValue;
break;
}
document.getElementById("primoTab").value = tabValue;
document.forms["searchForm"].submit();
}
</script>
<!--End Javascript for Primo VE widget-->
</body>
</html>
@laurenlibrarian
Copy link
Author

If admins change the names of values, "MyInst_and_CI," "MyInstitution," "CentralIndex," or the other optional collections (Ebsco/Course Reserves), the Javascript and option value in the HTML need to be changed in this code as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment