Skip to content

Commit

Permalink
Update searchform.js (#1336)
Browse files Browse the repository at this point in the history
* Update searchform.js

Fix sessionStorage.querystring bug.  Javascript was not handling setting db (collections) checkbox array from user sessionStorage.

* Update searchform.js

Correcting variable name
  • Loading branch information
GregoryPost authored May 17, 2024
1 parent 00eda61 commit 79e2a1b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions collections/search/js/searchform.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,16 @@ function setSearchForm(frm) {
if (sessionStorage.querystr) {
var urlVar = parseUrlVariables(sessionStorage.querystr);

if (urlVar.db) {
qryCollections = urlVar.db.split(',');
let allcb = document.getElementById("dballcb");
allcb.checked = false;
selectAll(allcb);
for (var i = 0; i < qryCollections.length; i++){
document.getElementById("collection-" + qryCollections[i]).checked = true;
}
}

if (
typeof urlVar.usethes !== "undefined" &&
(urlVar.usethes == "" || urlVar.usethes == "0")
Expand Down Expand Up @@ -822,11 +832,6 @@ function setSearchForm(frm) {
frm.includecult.checked = true;
}
}
if (urlVar.db) {
if (frm?.db) {
frm.db.value = urlVar.db;
}
}
for (var i in urlVar) {
if (`${i}`.indexOf("traitid-") == 0) {
var traitInput = document.getElementById("traitstateid-" + urlVar[i]);
Expand Down

0 comments on commit 79e2a1b

Please sign in to comment.