From 8c208fce8a1f57495228ccac6ec2284a5b4635d2 Mon Sep 17 00:00:00 2001 From: Jake Litrell Date: Wed, 24 Feb 2016 17:23:02 -0500 Subject: [PATCH] LP#1519055: Some JS fixes Adding basic javascript to remove our search filter from the textbox on an advanced search form. Because of the interplay among various checkboxes/modifiers/filters, there may be duplicate filters applied from another function's form submit; this removes all at once. Signed-off-by: Jake Litrell Signed-off-by: Ben Shum --- Open-ILS/src/templates/opac/results.tt2 | 9 +++------ Open-ILS/web/js/ui/default/opac/simple.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/templates/opac/results.tt2 b/Open-ILS/src/templates/opac/results.tt2 index 15bce7d13e..284fbb9974 100644 --- a/Open-ILS/src/templates/opac/results.tt2 +++ b/Open-ILS/src/templates/opac/results.tt2 @@ -104,15 +104,12 @@ -%] [% END %] - - diff --git a/Open-ILS/web/js/ui/default/opac/simple.js b/Open-ILS/web/js/ui/default/opac/simple.js index 7fa20cb647..2f57bf6066 100644 --- a/Open-ILS/web/js/ui/default/opac/simple.js +++ b/Open-ILS/web/js/ui/default/opac/simple.js @@ -100,3 +100,14 @@ function search_modifier_onchange(type, checkbox, submitOnChange) { checkbox.form.submit(); } } + +function exclude_onchange(checkbox) { + if (checkbox.form._adv && !checkbox.checked) { + var search_box = $('search_box'); + // 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, ""); + } + + checkbox.form.submit(); +} -- 2.11.0