When advanced search limiters are applied, you cannot successfully
uncheck the Exclude Electronic Resources checkbox. When you uncheck it,
your current search is reloaded, but e-resources are still excluded
(and the box remains checked).
When you use the checkbox to exclude e-resources, the search form on the
results page contains a hidden input element:
<input type="hidden" name="fi:-search_format" value="electronic" />
This commit uses Javascript to remove that element from the search form
when the box is unchecked, before submitting the search.
Test plan:
[1] Enable the "Exclude Electronic Resources" checkbox in config.tt2.
[2] Do an advanced search, applying at least one search filter (e.g.
Language = "English").
[3] On the search results page, check the Exclude Electronic Resources
checkbox. This repeats your search, excluding e-resources.
[4] Uncheck the Exclude Electronic Resources box. Your search is
repeated, but e-resources are still excluded and the box remains
checked on your new results page.
[5] Apply this fix.
[6] Refresh the page or clear your browser cache, and try to uncheck the
Exclude Electronic Resources box again. This time, it should work:
e-resources will no longer be excluded, and the box is unchecked
when your new results page loads.
Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
// Other functions' form submits may create duplicates of this, so /g
var reg = /-search_format\(electronic\)/g;
search_box.value = search_box.value.replace(reg, "");
+ // Remove from the search form itself
+ var search_format_inputs = document.getElementsByName("fi:-search_format");
+ for (var j = 0; j < search_format_inputs.length; j++) {
+ if (search_format_inputs[j].value == 'electronic') {
+ search_format_inputs[j].parentNode.removeChild(search_format_inputs[j]);
+ }
+ }
+
}
checkbox.form.submit();