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 <jake@masslnc.org>
Signed-off-by: Ben Shum <ben@evergreener.net>
-%]
<input type="hidden" name="detail_record_view" value="1" />
[% END %]
-
<label class="results_header_lbl" for='opac.result.excludeelec'>
- <input type='checkbox' name="fi:-search_format" value="electronic"
- onchange="search_modifier_onchange('available', this, true)"
- [%- CGI.param('fi:-search_format').grep('electronic').size ? ' checked="checked"' : '' %]
- id='opac.result.excludeelec' />
+ <input type='checkbox' id='opac.result.excludeelec' name="fi:-search_format" value="electronic"
+ onchange="exclude_onchange(this)"
+ [%- CGI.param('fi:-search_format').grep('electronic').size ? ' checked="checked"' : '' %] />
[% l("Exclude Electronic Resources") %]
</label>
-
</div>
</div>
</div>
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();
+}